diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-06-15 01:29:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-15 01:29:01 +0800 |
commit | 8b2cfd45fa8dd4f01d9535ad43bc37ce4953e78d (patch) | |
tree | 81da2985dbaa0af9fa0056b5287081fe961842ae /lib/scope.js | |
parent | ae9f56be109ccc27003868e997143823957f874d (diff) | |
download | tracifyjs-8b2cfd45fa8dd4f01d9535ad43bc37ce4953e78d.tar.gz tracifyjs-8b2cfd45fa8dd4f01d9535ad43bc37ce4953e78d.zip |
fix corner case in `rename` (#4000)
fixes #3999
Diffstat (limited to 'lib/scope.js')
-rw-r--r-- | lib/scope.js | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/scope.js b/lib/scope.js index 2f49df76..66314766 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -543,11 +543,8 @@ AST_Toplevel.DEFMETHOD("expand_names", function(options) { var redef = def.redefined(); var name = redef ? redef.rename || redef.name : next_name(); def.rename = name; - def.orig.forEach(function(sym) { - sym.name = name; - }); - def.references.forEach(function(sym) { - sym.name = name; + def.orig.concat(def.references).forEach(function(sym) { + if (sym.definition() === def) sym.name = name; }); } }); |