Call erased functions

This commit is contained in:
Ayaz Hafiz 2023-06-25 18:10:51 -05:00
parent 558d7459b4
commit 510a421748
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
10 changed files with 350 additions and 23 deletions

View file

@ -5452,25 +5452,21 @@ pub fn with_hole<'a>(
env.arena.alloc(result),
);
}
RawFunctionLayout::ErasedFunction(..) => {
// What we want here is
// f = compile(loc_expr)
// joinpoint join result:
// <hole>
// if (f.value) {
// f = cast(f, (..params, void*) -> ret);
// result = f ..args
// jump join result
// } else {
// f = cast(f, (..params) -> ret);
// result = f ..args
// jump join result
// }
todo_lambda_erasure!(
"{:?} :: {:?}",
RawFunctionLayout::ErasedFunction(arg_layouts, ret_layout) => {
let hole_layout =
layout_cache.from_var(env.arena, fn_var, env.subs).unwrap();
result = erased::call_erased_function(
env,
layout_cache,
procs,
loc_expr.value,
full_layout
)
fn_var,
(arg_layouts, ret_layout),
arg_symbols,
assigned,
hole,
hole_layout,
);
}
RawFunctionLayout::ZeroArgumentThunk(_) => {
unreachable!(