babel-traverse
Advanced tools
Comparing version 7.0.0-alpha.17 to 7.0.0-alpha.18
@@ -48,4 +48,4 @@ "use strict"; | ||
function getFunctionParent() { | ||
return this.findParent(function (path) { | ||
return path.isFunction() || path.isProgram(); | ||
return this.findParent(function (p) { | ||
return p.isFunction(); | ||
}); | ||
@@ -52,0 +52,0 @@ } |
@@ -158,4 +158,4 @@ "use strict"; | ||
function _guessExecutionStatusRelativeTo(target) { | ||
var targetFuncParent = target.scope.getFunctionParent(); | ||
var selfFuncParent = this.scope.getFunctionParent(); | ||
var targetFuncParent = target.scope.getFunctionParent() || target.scope.getProgramParent(); | ||
var selfFuncParent = this.scope.getFunctionParent() || target.scope.getProgramParent(); | ||
@@ -162,0 +162,0 @@ if (targetFuncParent.node !== selfFuncParent.node) { |
@@ -122,3 +122,4 @@ "use strict"; | ||
if (declar.isVar()) { | ||
path.scope.getFunctionParent().registerBinding("var", declar); | ||
var parentScope = path.scope.getFunctionParent() || path.scope.getProgramParent(); | ||
parentScope.registerBinding("var", declar); | ||
} | ||
@@ -134,3 +135,4 @@ } | ||
path.scope.getFunctionParent().registerDeclaration(path); | ||
var parent = path.scope.getFunctionParent() || path.scope.getProgramParent(); | ||
parent.registerDeclaration(path); | ||
}, | ||
@@ -816,3 +818,3 @@ ReferencedIdentifier: function ReferencedIdentifier(path, state) { | ||
if (path.isSwitchStatement()) { | ||
path = this.getFunctionParent().path; | ||
path = (this.getFunctionParent() || this.getProgramParent()).path; | ||
} | ||
@@ -855,3 +857,3 @@ | ||
throw new Error("We couldn't find a Function or Program..."); | ||
throw new Error("Couldn't find a Program"); | ||
}; | ||
@@ -868,3 +870,3 @@ | ||
throw new Error("We couldn't find a Function or Program..."); | ||
return null; | ||
}; | ||
@@ -871,0 +873,0 @@ |
{ | ||
"name": "babel-traverse", | ||
"version": "7.0.0-alpha.17", | ||
"version": "7.0.0-alpha.18", | ||
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", | ||
@@ -11,6 +11,6 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>", | ||
"dependencies": { | ||
"babel-code-frame": "7.0.0-alpha.17", | ||
"babel-helper-function-name": "7.0.0-alpha.17", | ||
"babel-messages": "7.0.0-alpha.17", | ||
"babel-types": "7.0.0-alpha.17", | ||
"babel-code-frame": "7.0.0-alpha.18", | ||
"babel-helper-function-name": "7.0.0-alpha.18", | ||
"babel-messages": "7.0.0-alpha.18", | ||
"babel-types": "7.0.0-alpha.18", | ||
"babylon": "7.0.0-beta.18", | ||
@@ -23,5 +23,5 @@ "debug": "^2.2.0", | ||
"devDependencies": { | ||
"babel-generator": "7.0.0-alpha.17", | ||
"babel-helper-plugin-test-runner": "7.0.0-alpha.17" | ||
"babel-generator": "7.0.0-alpha.18", | ||
"babel-helper-plugin-test-runner": "7.0.0-alpha.18" | ||
} | ||
} |
151825
4323
+ Addedbabel-code-frame@7.0.0-alpha.18(transitive)
+ Addedbabel-helper-function-name@7.0.0-alpha.18(transitive)
+ Addedbabel-helper-get-function-arity@7.0.0-alpha.18(transitive)
+ Addedbabel-messages@7.0.0-alpha.18(transitive)
+ Addedbabel-template@7.0.0-alpha.18(transitive)
+ Addedbabel-types@7.0.0-alpha.18(transitive)
- Removedbabel-code-frame@7.0.0-alpha.17(transitive)
- Removedbabel-helper-function-name@7.0.0-alpha.17(transitive)
- Removedbabel-helper-get-function-arity@7.0.0-alpha.17(transitive)
- Removedbabel-messages@7.0.0-alpha.17(transitive)
- Removedbabel-template@7.0.0-alpha.17(transitive)
- Removedbabel-types@7.0.0-alpha.17(transitive)
Updatedbabel-types@7.0.0-alpha.18