mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-02 19:32:17 +00:00
Expr::FunctionPointer
This commit is contained in:
parent
55fa8098d3
commit
cf30f02e01
11 changed files with 176 additions and 5 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue