drop unused assignment based on reduce_vars (#2709)

This commit is contained in:
Alex Lam S.L
2018-01-04 01:03:33 +08:00
committed by GitHub
parent 14778e049b
commit cfe3a98ce5
5 changed files with 238 additions and 15 deletions

View File

@@ -151,7 +151,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
node.references = [];
}
if (node instanceof AST_SymbolLambda) {
defun.def_function(node);
defun.def_function(node, defun);
}
else if (node instanceof AST_SymbolDefun) {
// Careful here, the scope where this should be defined is
@@ -318,6 +318,9 @@ AST_Scope.DEFMETHOD("def_variable", function(symbol, init){
var def = this.variables.get(symbol.name);
if (def) {
def.orig.push(symbol);
if (def.init && (def.scope !== symbol.scope || def.init instanceof AST_Function)) {
def.init = init;
}
} else {
def = new SymbolDef(this, symbol, init);
this.variables.set(symbol.name, def);