mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Thread simple model of "ErasedLambdas" through proc layouts
But none of these paths are yet exercised.
This commit is contained in:
parent
6eae480e36
commit
c459757062
8 changed files with 79 additions and 11 deletions
|
@ -481,9 +481,24 @@ impl From<LayoutProblem> for RuntimeError {
|
|||
}
|
||||
}
|
||||
|
||||
/// When we do not kind functions, we type-erase functions to opaque pointers.
|
||||
/// The erased function definition, however, continues to hold data about how the erased function
|
||||
/// behaves.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum OpaqueFunctionData<'a> {
|
||||
/// This function is not capturing, and needs no extra data regarding closures.
|
||||
Null,
|
||||
/// This function is capturing.
|
||||
Capturing {
|
||||
/// The concrete type of the closure data expected by a call to the function.
|
||||
closure_data_layout: InLayout<'a>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum RawFunctionLayout<'a> {
|
||||
Function(&'a [InLayout<'a>], LambdaSet<'a>, InLayout<'a>),
|
||||
ErasedFunction(&'a [InLayout<'a>], OpaqueFunctionData<'a>, InLayout<'a>),
|
||||
ZeroArgumentThunk(InLayout<'a>),
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue