aboutsummaryrefslogtreecommitdiff
path: root/lib/scope.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-10-20 07:02:39 +0100
committerGitHub <noreply@github.com>2020-10-20 14:02:39 +0800
commitfd8c0212b8d81b4f1630155bb170214ce87d0e70 (patch)
treeead89cf9675afc8f8a465fb73a389e520274cfa8 /lib/scope.js
parent256950c2c0b4dc0c133fcc8aaf85f15579eb190f (diff)
downloadtracifyjs-fd8c0212b8d81b4f1630155bb170214ce87d0e70.tar.gz
tracifyjs-fd8c0212b8d81b4f1630155bb170214ce87d0e70.zip
fix corner case in `ie8` (#4232)
fixes #4231
Diffstat (limited to 'lib/scope.js')
-rw-r--r--lib/scope.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/scope.js b/lib/scope.js
index 208633d0..80034a54 100644
--- a/lib/scope.js
+++ b/lib/scope.js
@@ -277,6 +277,9 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
function redefine(node, scope) {
var name = node.name;
var old_def = node.thedef;
+ if (!all(old_def.orig, function(sym) {
+ return !(sym instanceof AST_SymbolConst || sym instanceof AST_SymbolLet);
+ })) return;
var new_def = scope.find_variable(name);
if (new_def) {
var redef = new_def.redefined();
@@ -294,7 +297,6 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
node.redef = true;
node.thedef = new_def;
node.reference(options);
- if (node instanceof AST_SymbolConst || node instanceof AST_SymbolLet) new_def.orig.push(node);
});
if (old_def.lambda) new_def.lambda = true;
if (new_def.undeclared) self.variables.set(name, new_def);