Expr::FunctionPointer

This commit is contained in:
Ayaz Hafiz 2023-06-25 18:46:08 -05:00
parent 55fa8098d3
commit cf30f02e01
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
11 changed files with 176 additions and 5 deletions

View file

@ -1090,6 +1090,44 @@ pub(crate) fn build_exp_expr<'a, 'ctx>(
)
}
ExprBox { symbol } => {
let (value, layout) = scope.load_symbol_and_layout(symbol);
let basic_type =
basic_type_from_layout(env, layout_interner, layout_interner.get_repr(layout));
let allocation = reserve_with_refcount_help(
env,
basic_type,
layout_interner.stack_size(layout),
layout_interner.alignment_bytes(layout),
);
store_roc_value(
env,
layout_interner,
layout_interner.get_repr(layout),
allocation,
value,
);
allocation.into()
}
ExprUnbox { symbol } => {
let value = scope.load_symbol(symbol);
debug_assert!(value.is_pointer_value());
load_roc_value(
env,
layout_interner,
layout_interner.get_repr(layout),
value.into_pointer_value(),
"load_boxed_value",
)
}
FunctionPointer { .. } => todo_lambda_erasure!(),
Reset {
symbol,
update_mode,