fix spec.blockScopedFunctions shouldVisit method

This commit is contained in:
Sebastian McKenzie 2015-04-26 21:15:08 +01:00
parent 470ebf3a46
commit 0be93563dd

View File

@ -24,12 +24,17 @@ function statementList(key, path, file) {
}
export function shouldVisit(node) {
if (node.type !== "BlockStatement") return false;
for (var i = 0; i < node.body.length; i++) {
if (node.body[i].type === "FunctionDeclaration") return true;
var body;
if (node.type === "SwitchCase") {
body = node.consequent;
} else if (node.type === "BlockStatement") {
body = node.body;
}
if (body) {
for (var i = 0; i < body.length; i++) {
if (body[i].type === "FunctionDeclaration") return true;
}
}
return false;
}