diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-10-15 19:44:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-15 19:44:07 +0800 |
commit | 8af2f5fbcf91279db86f71e9a889d69b262370c5 (patch) | |
tree | 2b31927556b363debf733945c0536981ba1c0db1 /lib/scope.js | |
parent | 86a801632337aa45179f1d4ba4e46c8ede603c46 (diff) | |
download | tracifyjs-8af2f5fbcf91279db86f71e9a889d69b262370c5.tar.gz tracifyjs-8af2f5fbcf91279db86f71e9a889d69b262370c5.zip |
fix corner case in `rename` (#3481)
fixes #3480
Diffstat (limited to 'lib/scope.js')
-rw-r--r-- | lib/scope.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/scope.js b/lib/scope.js index 7da982a0..01a67b7d 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -511,13 +511,14 @@ AST_Toplevel.DEFMETHOD("expand_names", function(options) { if (def.global && options.cache) return; if (def.unmangleable(options)) return; if (options.reserved.has[def.name]) return; - var d = def.redefined(); - def.name = d ? d.name : next_name(); + var redef = def.redefined(); + var name = redef ? redef.rename || redef.name : next_name(); + def.rename = name; def.orig.forEach(function(sym) { - sym.name = def.name; + sym.name = name; }); def.references.forEach(function(sym) { - sym.name = def.name; + sym.name = name; }); } }); |