Simplify how glue_procs are handled

This commit is contained in:
Richard Feldman 2022-11-13 21:04:27 -05:00
parent d35d268a6b
commit 8e2bbee377
No known key found for this signature in database
GPG key ID: F1F21AA5B1D9E43B
5 changed files with 557 additions and 448 deletions

View file

@ -3016,7 +3016,7 @@ fn finish_specialization<'a>(
let ret = &layout.result;
for layout in layout.arguments.iter().chain([ret]) {
let glue_procs = roc_mono::ir::generate_glue_procs(
let all_glue_procs = roc_mono::ir::generate_glue_procs(
module_id,
ident_ids,
arena,
@ -3024,8 +3024,16 @@ fn finish_specialization<'a>(
*layout,
);
glue_getters.extend(glue_procs.procs.iter().map(|t| t.0));
procedures.extend(glue_procs.procs);
glue_getters.extend(all_glue_procs.iter().flat_map(|(_, glue_procs)| {
glue_procs
.iter()
.map(|glue_proc| (glue_proc.name, glue_proc.proc_layout))
}));
procedures.extend(all_glue_procs.into_iter().flat_map(|(_, glue_procs)| {
glue_procs
.into_iter()
.map(|glue_proc| ((glue_proc.name, glue_proc.proc_layout), glue_proc.proc))
}));
}
}