fix corner case in reduce_vars (#3510)

fixes #3509
This commit is contained in:
Alex Lam S.L
2019-10-22 20:36:05 +08:00
committed by GitHub
parent 0b3705e82f
commit 02308a7b56
2 changed files with 29 additions and 3 deletions

View File

@@ -292,9 +292,7 @@ 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;
}
if (def.init instanceof AST_Function) def.init = init;
} else {
def = new SymbolDef(this, symbol, init);
this.variables.set(symbol.name, def);