mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Push interned layouts as mut throughout the backend, and intern box layouts
This commit is contained in:
parent
dd6a72fc46
commit
7ab7fdfa7b
26 changed files with 769 additions and 375 deletions
|
@ -434,11 +434,12 @@ impl<'a, 'r> Ctx<'a, 'r> {
|
|||
None
|
||||
}
|
||||
&Expr::ExprBox { symbol } => self.with_sym_layout(symbol, |ctx, _def_line, layout| {
|
||||
Some(Layout::Boxed(ctx.alloc(layout)))
|
||||
let inner = ctx.interner.insert(ctx.alloc(layout));
|
||||
Some(Layout::Boxed(inner))
|
||||
}),
|
||||
&Expr::ExprUnbox { symbol } => {
|
||||
self.with_sym_layout(symbol, |ctx, def_line, layout| match ctx.resolve(layout) {
|
||||
Layout::Boxed(inner) => Some(*inner),
|
||||
Layout::Boxed(inner) => Some(*ctx.interner.get(inner)),
|
||||
_ => {
|
||||
ctx.problem(ProblemKind::UnboxNotABox { symbol, def_line });
|
||||
None
|
||||
|
@ -671,7 +672,10 @@ fn resolve_recursive_layout<'a>(
|
|||
layout
|
||||
}
|
||||
},
|
||||
Layout::Boxed(inner) => Layout::Boxed(arena.alloc(go!(*inner))),
|
||||
Layout::Boxed(inner) => {
|
||||
let inner = go!(*interner.get(inner));
|
||||
Layout::Boxed(interner.insert(arena.alloc(inner)))
|
||||
}
|
||||
Layout::Struct {
|
||||
field_order_hash,
|
||||
field_layouts,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue