diff options
Diffstat (limited to 'lib/scope.js')
-rw-r--r-- | lib/scope.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/scope.js b/lib/scope.js index ff0cb58c..a285f919 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -212,7 +212,11 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { argname.walk(tw); }); in_arg.pop(); - walk_body(node, tw); + if (node instanceof AST_Arrow && node.value) { + node.value.walk(tw); + } else { + walk_body(node, tw); + } return true; } if (node instanceof AST_LoopControl) { @@ -249,7 +253,9 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { } if (!sym) { sym = self.def_global(node); - } else if (name == "arguments" && sym.scope instanceof AST_Lambda) { + } else if (name == "arguments" + && sym.orig[0] instanceof AST_SymbolFunarg + && !(sym.scope instanceof AST_Arrow)) { if (!(tw.parent() instanceof AST_PropAccess)) { sym.scope.uses_arguments = "d"; } else if (!sym.scope.uses_arguments) { @@ -360,6 +366,9 @@ AST_BlockScope.DEFMETHOD("init_vars", function(parent_scope) { AST_Scope.DEFMETHOD("init_vars", function(parent_scope) { init_scope_vars(this, parent_scope); }); +AST_Arrow.DEFMETHOD("init_vars", function(parent_scope) { + init_scope_vars(this, parent_scope); +}); AST_Lambda.DEFMETHOD("init_vars", function(parent_scope) { init_scope_vars(this, parent_scope); this.uses_arguments = false; |