mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
steps towards closures and Effects
This commit is contained in:
parent
edfc96628e
commit
607799b96e
7 changed files with 140 additions and 39 deletions
|
@ -48,6 +48,23 @@ impl<'a> ClosureLayout<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn extend_function_layout(
|
||||
arena: &'a Bump,
|
||||
argument_layouts: &'a [Layout<'a>],
|
||||
closure_layout: Self,
|
||||
ret_layout: &'a Layout<'a>,
|
||||
) -> Layout<'a> {
|
||||
let closure_data_layout = closure_layout.into_layout();
|
||||
// define the function pointer
|
||||
let function_ptr_layout = {
|
||||
let mut temp = Vec::from_iter_in(argument_layouts.iter().cloned(), arena);
|
||||
temp.push(closure_data_layout.clone());
|
||||
Layout::FunctionPointer(temp.into_bump_slice(), ret_layout)
|
||||
};
|
||||
|
||||
function_ptr_layout
|
||||
}
|
||||
|
||||
pub fn stack_size(&self, pointer_size: u32) -> u32 {
|
||||
self.max_size
|
||||
.iter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue