feat: Emit keyword

This commit is contained in:
Micah Kendall
2024-04-01 15:16:35 +11:00
committed by Lucas
parent 23713ce6fa
commit d25b8f91c7
11 changed files with 148 additions and 6 deletions

View File

@@ -530,6 +530,14 @@ impl<'a> CodeGenerator<'a> {
self.build(then, module_build_name, &[]),
),
TypedExpr::Emit {
tipo, then, text, ..
} => AirTree::emit(
self.build(text, module_build_name, &[]),
tipo.clone(),
self.build(then, module_build_name, &[]),
),
TypedExpr::When {
tipo,
subject,
@@ -5310,6 +5318,15 @@ impl<'a> CodeGenerator<'a> {
Some(term)
}
Air::Emit { .. } => {
let text = arg_stack.pop().unwrap();
let term = arg_stack.pop().unwrap();
let term = term.delayed_trace(text);
Some(term)
}
Air::ErrorTerm { validator, .. } => {
if validator {
Some(Term::Error.apply(Term::Error.force()))