mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-11 06:16:21 +00:00
Call erased functions
This commit is contained in:
parent
558d7459b4
commit
510a421748
10 changed files with 350 additions and 23 deletions
|
@ -10,8 +10,8 @@ use crate::{
|
|||
ModifyRc, Param, Proc, ProcLayout, Stmt,
|
||||
},
|
||||
layout::{
|
||||
Builtin, InLayout, Layout, LayoutInterner, LayoutRepr, STLayoutInterner, TagIdIntType,
|
||||
UnionLayout,
|
||||
Builtin, FunctionPointer, InLayout, Layout, LayoutInterner, LayoutRepr, STLayoutInterner,
|
||||
TagIdIntType, UnionLayout,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -642,6 +642,23 @@ impl<'a, 'r> Ctx<'a, 'r> {
|
|||
}
|
||||
Some(*ret_layout)
|
||||
}
|
||||
CallType::ByPointer {
|
||||
pointer,
|
||||
ret_layout,
|
||||
arg_layouts,
|
||||
} => {
|
||||
let expected_layout =
|
||||
self.interner
|
||||
.insert_direct_no_semantic(LayoutRepr::FunctionPointer(FunctionPointer {
|
||||
args: arg_layouts,
|
||||
ret: *ret_layout,
|
||||
}));
|
||||
self.check_sym_layout(*pointer, expected_layout, UseKind::SwitchCond);
|
||||
for (arg, wanted_layout) in arguments.iter().zip(arg_layouts.iter()) {
|
||||
self.check_sym_layout(*arg, *wanted_layout, UseKind::CallArg);
|
||||
}
|
||||
Some(*ret_layout)
|
||||
}
|
||||
CallType::HigherOrder(HigherOrderLowLevel {
|
||||
op: _,
|
||||
closure_env_layout: _,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue