mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
Implement return keyword
This commit is contained in:
parent
20a539a96d
commit
b3e60f9d3a
39 changed files with 594 additions and 80 deletions
|
@ -5878,6 +5878,28 @@ pub fn with_hole<'a>(
|
|||
}
|
||||
}
|
||||
}
|
||||
Return {
|
||||
return_value,
|
||||
return_var,
|
||||
} => {
|
||||
let return_symbol = possible_reuse_symbol_or_specialize(
|
||||
env,
|
||||
procs,
|
||||
layout_cache,
|
||||
&return_value.value,
|
||||
return_var,
|
||||
);
|
||||
|
||||
assign_to_symbol(
|
||||
env,
|
||||
procs,
|
||||
layout_cache,
|
||||
return_var,
|
||||
*return_value,
|
||||
return_symbol,
|
||||
Stmt::Ret(return_symbol),
|
||||
)
|
||||
}
|
||||
TypedHole(_) => runtime_error(env, "Hit a blank"),
|
||||
RuntimeError(e) => runtime_error(env, env.arena.alloc(e.runtime_message())),
|
||||
Crash { msg, ret_var: _ } => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue