mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-11 06:16:21 +00:00
add alloca as an expression
This commit is contained in:
parent
750234f2de
commit
cdd2aab217
15 changed files with 171 additions and 14 deletions
|
@ -30,6 +30,7 @@ pub enum UseKind {
|
|||
ErasedMake(ErasedField),
|
||||
Erased,
|
||||
FunctionPointer,
|
||||
Alloca,
|
||||
}
|
||||
|
||||
pub enum ProblemKind<'a> {
|
||||
|
@ -524,6 +525,17 @@ impl<'a, 'r> Ctx<'a, 'r> {
|
|||
self.check_sym_exists(symbol);
|
||||
None
|
||||
}
|
||||
Expr::Alloca {
|
||||
initializer,
|
||||
element_layout,
|
||||
} => {
|
||||
if let Some(initializer) = initializer {
|
||||
self.check_sym_exists(*initializer);
|
||||
self.check_sym_layout(*initializer, *element_layout, UseKind::Alloca);
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
Expr::RuntimeErrorFunction(_) => None,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -513,6 +513,7 @@ fn format_use_kind(use_kind: UseKind) -> &'static str {
|
|||
},
|
||||
UseKind::Erased => "erasure",
|
||||
UseKind::FunctionPointer => "function pointer",
|
||||
UseKind::Alloca => "alloca initializer",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue