Record references in can/expr before evaluating to runtime error

This commit is contained in:
Chadtech 2020-11-21 14:07:09 -05:00
parent 6f9097da56
commit 767a348812
2 changed files with 42 additions and 4 deletions

View file

@ -349,6 +349,10 @@ pub fn canonicalize_expr<'a>(
// Default: We're not tail-calling a symbol (by name), we're tail-calling a function value.
output.tail_call = None;
for arg_out in outputs {
output.references = output.references.union(arg_out.references);
}
let expr = match fn_expr.value {
Var(symbol) => {
output.references.calls.insert(symbol);
@ -400,10 +404,6 @@ pub fn canonicalize_expr<'a>(
}
};
for arg_out in outputs {
output.references = output.references.union(arg_out.references);
}
(expr, output)
}
ast::Expr::Var { module_name, ident } => {