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

@ -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: _,