mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 00:01:16 +00:00
get rid of env.closure_name_symbol
This commit is contained in:
parent
465fad9da1
commit
2973af5f79
3 changed files with 12 additions and 19 deletions
|
@ -1211,18 +1211,18 @@ fn canonicalize_pending_body<'a>(
|
|||
let outer_identifier = env.tailcallable_symbol;
|
||||
env.tailcallable_symbol = Some(*defined_symbol);
|
||||
|
||||
// register the name of this closure, to make sure the closure won't capture it's own name
|
||||
env.closure_name_symbol = Some(*defined_symbol);
|
||||
|
||||
let (mut closure_data, can_output) =
|
||||
crate::expr::canonicalize_closure(env, var_store, scope, arguments, body);
|
||||
let (mut closure_data, can_output) = crate::expr::canonicalize_closure(
|
||||
env,
|
||||
var_store,
|
||||
scope,
|
||||
arguments,
|
||||
body,
|
||||
Some(*defined_symbol),
|
||||
);
|
||||
|
||||
// reset the tailcallable_symbol
|
||||
env.tailcallable_symbol = outer_identifier;
|
||||
|
||||
let closure_references = can_output.references.clone();
|
||||
output.references.union_mut(&can_output.references);
|
||||
|
||||
// The closure is self tail recursive iff it tail calls itself (by defined name).
|
||||
let is_recursive = match can_output.tail_call {
|
||||
Some(tail_symbol) if tail_symbol == *defined_symbol => Recursive::TailRecursive,
|
||||
|
@ -1242,6 +1242,7 @@ fn canonicalize_pending_body<'a>(
|
|||
vars_by_symbol,
|
||||
);
|
||||
|
||||
let closure_references = can_output.references.clone();
|
||||
output.union(can_output);
|
||||
|
||||
DefOutput {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue