enhance collapse_vars & dead_code (#4491)

This commit is contained in:
Alex Lam S.L
2021-01-01 13:52:14 +00:00
committed by GitHub
parent 2dbafbb4ee
commit 0417a69c3e
6 changed files with 120 additions and 45 deletions

View File

@@ -48,7 +48,6 @@ function SymbolDef(id, scope, orig, init) {
this.global = false;
this.id = id;
this.init = init;
this.lambda = orig instanceof AST_SymbolLambda;
this.mangled_name = null;
this.name = orig.name;
this.orig = [ orig ];
@@ -352,11 +351,10 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
}
old_def.defun = new_def.scope;
old_def.forEach(function(node) {
node.redef = true;
node.redef = old_def;
node.thedef = new_def;
node.reference(options);
});
if (old_def.lambda) new_def.lambda = true;
if (new_def.undeclared) self.variables.set(name, new_def);
}
});