fix corner case in mangle (#4528)

fixes #4527
This commit is contained in:
Alex Lam S.L
2021-01-09 20:20:43 +00:00
committed by GitHub
parent 770f3ba5fe
commit 0818d396c5
2 changed files with 36 additions and 0 deletions

View File

@@ -611,6 +611,7 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) {
if (!(sym instanceof AST_SymbolConst)) return false;
var scope = def.scope.resolve();
if (def.scope === scope) return false;
if (def.scope.parent_scope.find_variable(sym.name)) return false;
redef = scope.def_variable(sym);
scope.to_mangle.push(redef);
}