simplify NodePath.getScope

This commit is contained in:
Sebastian McKenzie 2015-06-06 16:17:43 +01:00
parent 75699db716
commit 1abd3419f6
2 changed files with 4 additions and 4 deletions

View File

@ -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();
}

View File

@ -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;