mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
Fix anonymous function code gen
This commit is contained in:
parent
bf11262e61
commit
85ec1e0f72
2 changed files with 28 additions and 14 deletions
|
@ -331,16 +331,24 @@ pub fn build_expr<'a, 'ctx, 'env>(
|
|||
)
|
||||
}
|
||||
},
|
||||
FunctionPointer(symbol) => {
|
||||
AnonymousFunctionPointer(symbol, layout) => {
|
||||
let fn_name = layout_ids
|
||||
.get(*symbol, layout)
|
||||
.to_symbol_string(*symbol, &env.interns);
|
||||
let ptr = env
|
||||
.module
|
||||
.get_function(symbol.ident_string(&env.interns))
|
||||
.get_function(fn_name.as_str())
|
||||
.unwrap_or_else(|| panic!("Could not get pointer to unknown function {:?}", symbol))
|
||||
.as_global_value()
|
||||
.as_pointer_value();
|
||||
|
||||
BasicValueEnum::PointerValue(ptr)
|
||||
}
|
||||
NamedFunctionPointer(_) => {
|
||||
unreachable!(
|
||||
"Tried to build a NamedFunctionPointer that was never resolved into a CallByName."
|
||||
);
|
||||
}
|
||||
CallByPointer(sub_expr, args, _var) => {
|
||||
let mut arg_vals: Vec<BasicValueEnum> = Vec::with_capacity_in(args.len(), env.arena);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue