diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-10-24 23:43:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-24 23:43:19 +0800 |
commit | 82b3eed5ef7fa8c3b031778817b325f26db7b5cb (patch) | |
tree | 60d30b7c7e8bc3b1423ee6fdf554fb533f1d4884 /lib | |
parent | 0f7aa41e339b574ee0f67c093438d356a8a85477 (diff) | |
download | tracifyjs-82b3eed5ef7fa8c3b031778817b325f26db7b5cb.tar.gz tracifyjs-82b3eed5ef7fa8c3b031778817b325f26db7b5cb.zip |
fix corner case in `ie8` & `mangle` (#3524)
fixes #3523
Diffstat (limited to 'lib')
-rw-r--r-- | lib/scope.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/scope.js b/lib/scope.js index 6e33365c..edefc29b 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -214,7 +214,13 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { function redefine(node, scope) { var name = node.name; var old_def = node.thedef; - var new_def = scope.find_variable(name) || self.globals.get(name) || scope.def_variable(node); + var new_def = scope.find_variable(name); + if (new_def) { + var redef; + while (redef = new_def.redefined()) new_def = redef; + } else { + new_def = self.globals.get(name) || scope.def_variable(node); + } old_def.orig.concat(old_def.references).forEach(function(node) { node.thedef = new_def; node.reference(options); |