From 1abd3419f631562718ec477d5629802aae836cf9 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 6 Jun 2015 16:17:43 +0100 Subject: [PATCH] simplify NodePath.getScope --- src/babel/traversal/path/context.js | 2 +- src/babel/traversal/path/index.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/babel/traversal/path/context.js b/src/babel/traversal/path/context.js index 3a411a64b9..844856c73e 100644 --- a/src/babel/traversal/path/context.js +++ b/src/babel/traversal/path/context.js @@ -114,7 +114,7 @@ export function setScope() { if (this.opts && this.opts.noScope) return; var target = this.context || this.parentPath; - this.scope = NodePath.getScope(this, target && target.scope, this.hub); + this.scope = this.getScope(target && target.scope); if (this.scope) this.scope.init(); } diff --git a/src/babel/traversal/path/index.js b/src/babel/traversal/path/index.js index 138bfbe223..41f2318fe4 100644 --- a/src/babel/traversal/path/index.js +++ b/src/babel/traversal/path/index.js @@ -44,12 +44,12 @@ export default class NodePath { * Description */ - static getScope(path: NodePath, scope: Scope, hub?: Hub) { + getScope(scope: Scope) { var ourScope = scope; // we're entering a new scope so let's construct it! - if (path.isScope()) { - ourScope = new Scope(path, scope, hub); + if (this.isScope()) { + ourScope = new Scope(this, scope, this.hub); } return ourScope;