aboutsummaryrefslogtreecommitdiff
path: root/lib/scope.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-06-22 19:41:55 +0800
committeralexlamsl <alexlamsl@gmail.com>2018-06-24 04:00:36 +0800
commitab36b9b10a3e9923d76fdfba4f86cca1c07437d7 (patch)
treef01a11eb7a9af629d3108678a43b8b289d4cd168 /lib/scope.js
parent28330913d871dd4bdb4e59464c7230f9ae4174fa (diff)
downloadtracifyjs-ab36b9b10a3e9923d76fdfba4f86cca1c07437d7.tar.gz
tracifyjs-ab36b9b10a3e9923d76fdfba4f86cca1c07437d7.zip
fix corner case in `ie8` (#3198)
fixes #3197
Diffstat (limited to 'lib/scope.js')
-rw-r--r--lib/scope.js11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/scope.js b/lib/scope.js
index d4b13d12..8ce3e4da 100644
--- a/lib/scope.js
+++ b/lib/scope.js
@@ -132,10 +132,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
node.thedef = node;
node.references = [];
}
- if (node instanceof AST_SymbolLambda) {
- defun.def_function(node, node.name == "arguments" ? undefined : defun);
- }
- else if (node instanceof AST_SymbolDefun) {
+ if (node instanceof AST_SymbolDefun || options.ie8 && node instanceof AST_SymbolLambda) {
// Careful here, the scope where this should be defined is
// the parent scope. The reason is that we enter a new
// scope when we encounter the AST_Defun node (which is
@@ -143,6 +140,9 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
// later.
(node.scope = defun.parent_scope).def_function(node, defun);
}
+ else if (node instanceof AST_SymbolLambda) {
+ defun.def_function(node, node.name == "arguments" ? undefined : defun);
+ }
else if (node instanceof AST_SymbolVar) {
defun.def_variable(node, node.TYPE == "SymbolVar" ? null : undefined);
if (defun !== scope) {
@@ -349,9 +349,6 @@ function next_mangled_name(scope, options, def) {
holes.push(scope.cname);
}
scope.names_in_use[name] = true;
- if (options.ie8 && def.orig[0] instanceof AST_SymbolLambda) {
- names_in_use(scope.parent_scope, options)[name] = true;
- }
return name;
}