diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-05-24 04:46:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-24 11:46:58 +0800 |
commit | 1e787c556b916644e8ba2fc36fce024001f00ff8 (patch) | |
tree | 31ac8c02d19f77720d10c1b1bc9dbd3957aa6514 /lib | |
parent | df47632eccdc505810073d7bfced21bbf8c2dd98 (diff) | |
download | tracifyjs-1e787c556b916644e8ba2fc36fce024001f00ff8.tar.gz tracifyjs-1e787c556b916644e8ba2fc36fce024001f00ff8.zip |
fix corner case in `mangle` (#4961)
fixes #4960
Diffstat (limited to 'lib')
-rw-r--r-- | lib/scope.js | 5 |
1 files changed, 2 insertions, 3 deletions
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); |