diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2021-01-10 16:01:49 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-11 00:01:49 +0800 |
commit | dbfa5d4d14c1984da94c2435f349ecbd3dbb36e9 (patch) | |
tree | 134c227fce73b2c0cc73f9833d074a8ba367edf6 /lib | |
parent | ba54d074d8f434148a4f9ab5f59fcb70ff08dda9 (diff) | |
download | tracifyjs-dbfa5d4d14c1984da94c2435f349ecbd3dbb36e9.tar.gz tracifyjs-dbfa5d4d14c1984da94c2435f349ecbd3dbb36e9.zip |
fix corner case in `ie8` (#4532)
fixes #4531
Diffstat (limited to 'lib')
-rw-r--r-- | lib/scope.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/scope.js b/lib/scope.js index 689100cf..a241cc59 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -311,8 +311,9 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { } if (node instanceof AST_SymbolLambda) { var def = node.thedef; - redefine(node, node.scope.parent_scope.resolve()); - if (typeof node.thedef.init !== "undefined") { + if (!redefine(node, node.scope.parent_scope.resolve())) { + delete def.defun; + } else if (typeof node.thedef.init !== "undefined") { node.thedef.init = false; } else if (def.init) { node.thedef.init = def.init; @@ -332,7 +333,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { var old_def = node.thedef; if (!all(old_def.orig, function(sym) { return !(sym instanceof AST_SymbolConst || sym instanceof AST_SymbolLet); - })) return; + })) return false; var new_def = scope.find_variable(name); if (new_def) { var redef = new_def.redefined(); @@ -352,6 +353,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { node.reference(options); }); if (new_def.undeclared) self.variables.set(name, new_def); + return true; } }); |