From 1e787c556b916644e8ba2fc36fce024001f00ff8 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Mon, 24 May 2021 04:46:58 +0100 Subject: fix corner case in `mangle` (#4961) fixes #4960 --- lib/scope.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/scope.js b/lib/scope.js index 466ab8d6..c74c494a 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -70,9 +70,7 @@ SymbolDef.prototype = { } else if (!this.mangled_name && !this.unmangleable(options)) { var def = this.redefined(); if (def) { - var name = def.mangled_name || def.name; - this.mangled_name = name; - names_in_use(this.scope, options)[name] = true; + this.mangled_name = def.mangled_name || def.name; } else { this.mangled_name = next_mangled_name(this, options); } @@ -683,6 +681,7 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) { redef = scope.def_variable(sym); scope.to_mangle.push(redef); } else if (redef.mangled_name) { + names_in_use(def.scope, options)[redef.mangled_name] = true; return false; } redefined.push(def); -- cgit v1.2.3