aboutsummaryrefslogtreecommitdiff
path: root/lib/scope.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scope.js')
-rw-r--r--lib/scope.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/scope.js b/lib/scope.js
index 799b0dc6..600a6869 100644
--- a/lib/scope.js
+++ b/lib/scope.js
@@ -327,6 +327,13 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
self.uses_eval = true;
}
}
+ if (sym.init instanceof AST_LambdaDefinition && sym.scope !== sym.init.name.scope) {
+ var scope = node.scope;
+ do {
+ if (scope === sym.init.name.scope) break;
+ } while (scope = scope.parent_scope);
+ if (!scope) sym.init = undefined;
+ }
node.thedef = sym;
node.reference(options);
return true;