Implement return keyword

This commit is contained in:
Sam Mohr 2024-10-20 04:50:12 -07:00
parent 20a539a96d
commit b3e60f9d3a
No known key found for this signature in database
GPG key ID: EA41D161A3C1BC99
39 changed files with 594 additions and 80 deletions

View file

@ -220,6 +220,7 @@ impl<'a> LowerParams<'a> {
function_type: _,
closure_type: _,
return_type: _,
early_returns: _,
recursive: _,
arguments: _,
}) => {
@ -380,6 +381,12 @@ impl<'a> LowerParams<'a> {
expr_stack.push(&mut loc_message.value);
expr_stack.push(&mut loc_continuation.value);
}
Return {
return_value,
return_var: _,
} => {
expr_stack.push(&mut return_value.value);
}
RecordAccessor(_)
| ImportParams(_, _, None)
| ZeroArgumentTag {
@ -532,6 +539,7 @@ impl<'a> LowerParams<'a> {
function_type: self.var_store.fresh(),
closure_type: self.var_store.fresh(),
return_type: self.var_store.fresh(),
early_returns: vec![],
name: self.unique_symbol(),
captured_symbols,
recursive: roc_can::expr::Recursive::NotRecursive,

View file

@ -181,7 +181,8 @@ fn remove_for_reason(
def_region: _,
}
| Reason::CrashArg
| Reason::ImportParams(_) => {}
| Reason::ImportParams(_)
| Reason::Return => {}
}
}