mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
IT WORKS
This commit is contained in:
parent
d0f031fe6c
commit
40ffca2b7b
16 changed files with 511 additions and 200 deletions
|
@ -1097,6 +1097,14 @@ pub fn build_exp_expr<'a, 'ctx, 'env>(
|
|||
env.arena.alloc(format!("struct_field_access_{}_", index)),
|
||||
)
|
||||
.unwrap(),
|
||||
(StructValue(argument), Layout::Closure(_, _, _)) => env
|
||||
.builder
|
||||
.build_extract_value(
|
||||
argument,
|
||||
*index as u32,
|
||||
env.arena.alloc(format!("closure_field_access_{}_", index)),
|
||||
)
|
||||
.unwrap(),
|
||||
(other, layout) => {
|
||||
unreachable!("can only index into struct layout {:?} {:?}", other, layout)
|
||||
}
|
||||
|
@ -1179,7 +1187,10 @@ pub fn build_exp_expr<'a, 'ctx, 'env>(
|
|||
.module
|
||||
.get_function(fn_name.as_str())
|
||||
.unwrap_or_else(|| {
|
||||
panic!("Could not get pointer to unknown function {:?}", symbol)
|
||||
panic!(
|
||||
"Could not get pointer to unknown function {:?} {:?}",
|
||||
fn_name, layout
|
||||
)
|
||||
})
|
||||
.as_global_value()
|
||||
.as_pointer_value();
|
||||
|
|
|
@ -106,6 +106,12 @@ pub fn basic_type_from_layout<'ctx>(
|
|||
basic_type_from_function_layout(arena, context, args, ret_layout, ptr_bytes)
|
||||
}
|
||||
Closure(args, closure_layout, ret_layout) => {
|
||||
let args = {
|
||||
let mut temp = Vec::from_iter_in(args.iter().cloned(), arena);
|
||||
temp.push(Layout::Struct(closure_layout));
|
||||
temp.into_bump_slice()
|
||||
};
|
||||
|
||||
let function_pointer =
|
||||
basic_type_from_function_layout(arena, context, args, ret_layout, ptr_bytes);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue