Clean up functionChildrenVisitor a bit.

This commit is contained in:
Ingvar Stepanyan 2015-02-08 10:53:09 +02:00
parent 91362f80b1
commit 9e3c67a8a2

View File

@ -62,19 +62,16 @@ var functionChildrenVisitor = {
// transform return argument into statement if
// it contains tail recursion
transformExpression(node.argument, scope, state);
return;
} else if (t.isFunction(node)) {
return this.skip();
// inner function's bodies are irrelevant
this.skip();
} else if (t.isTryStatement(parent)) {
if (node === parent.block) {
return this.skip();
} else if (node === parent.finalizer) {
return;
} else {
if (parent.finalizer) {
this.skip();
}
return;
// `try`-blocks can't be optimized
this.skip();
} else if (parent.finalizer && node !== parent.finalizer) {
// `catch` clause followed by `finally` can't be optimized
this.skip();
}
}
}