From 2648268f3071393cbd8dc6f9e87d60f60c5cd9b8 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 4 Mar 2015 22:54:00 +1100 Subject: [PATCH] add contextVariables to scope --- src/babel/traversal/scope.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/babel/traversal/scope.js b/src/babel/traversal/scope.js index 2585102bbc..3d821683e9 100644 --- a/src/babel/traversal/scope.js +++ b/src/babel/traversal/scope.js @@ -82,6 +82,7 @@ export default class Scope { } static globals = flatten([globals.builtin, globals.browser, globals.node].map(Object.keys)); + static contextVariables = ["this", "arguments"]; /** * Description @@ -533,7 +534,7 @@ export default class Scope { if (t.isBlockStatement(block) || t.isProgram(block)) { block._declarations ||= {}; block._declarations[opts.key] = { - kind: opts.kind, + kind: opts.kind || "var", id: opts.id, init: opts.init }; @@ -668,6 +669,7 @@ export default class Scope { if (this.hasOwnBinding(name)) return true; if (this.parentHasBinding(name)) return true; if (includes(Scope.globals, name)) return true; + if (includes(Scope.contextVariables, name)) return true; return false; }