simplify NodePath.getScope
This commit is contained in:
parent
75699db716
commit
1abd3419f6
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user