stop using env.closures

This commit is contained in:
Folkert 2022-04-27 16:44:29 +02:00
parent c28a0af932
commit 6783b66db7
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C

View file

@ -1181,17 +1181,9 @@ fn canonicalize_pending_value_def<'a>(
// reset the tailcallable_symbol
env.tailcallable_symbol = outer_identifier;
let closure_references = can_output.references.clone();
output.references.union_mut(&can_output.references);
// Since everywhere in the code it'll be referred to by its defined name,
// remove its generated name from the closure map. (We'll re-insert it later.)
let closure_references = env.closures.remove(&closure_data.name).unwrap_or_else(|| {
panic!(
"Tried to remove symbol {:?} from procedures, but it was not found: {:?}",
closure_data.name, env.closures
)
});
// 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 == *symbol => Recursive::TailRecursive,