Defer specialization by one level only

This commit is contained in:
Richard Feldman 2020-07-12 23:43:55 -04:00
parent ff7429cab4
commit c6a0970b73
3 changed files with 94 additions and 77 deletions

View file

@ -227,8 +227,14 @@ pub fn build(
// Populate Procs further and get the low-level Expr from the canonical Expr
let main_body = Expr::new(&mut mono_env, loc_expr.value, &mut procs);
let mut headers = {
let num_headers = match &procs.pending_specializations {
Some(map) => map.len(),
None => 0,
};
let mut headers = Vec::with_capacity(procs.pending_specializations.len());
Vec::with_capacity(num_headers)
};
let mut layout_cache = LayoutCache::default();
let mut procs = roc_mono::expr::specialize_all(&mut mono_env, procs, &mut layout_cache);