mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
First pass at specialized erased
This commit is contained in:
parent
2cb2e37fd7
commit
fbad6bcb90
3 changed files with 42 additions and 26 deletions
|
@ -1396,13 +1396,23 @@ impl<'a> LambdaName<'a> {
|
|||
}
|
||||
|
||||
/// Closure data for a function
|
||||
enum ClosureDataKind<'a> {
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub(crate) enum ClosureDataKind<'a> {
|
||||
/// The function is compiled with lambda sets.
|
||||
LambdaSet(LambdaSet<'a>),
|
||||
/// The function is compiled as type-erased.
|
||||
Erased,
|
||||
}
|
||||
|
||||
impl<'a> ClosureDataKind<'a> {
|
||||
pub fn data_layout(&self) -> InLayout<'a> {
|
||||
match self {
|
||||
Self::LambdaSet(lambda_set) => lambda_set.full_layout,
|
||||
Self::Erased => Layout::OPAQUE_PTR,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn build_function_closure_data<'a>(
|
||||
env: &mut Env<'a, '_>,
|
||||
args: VariableSubsSlice,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue