optimise types.toStatement for when we're directly passed a statement

This commit is contained in:
Sebastian McKenzie 2014-11-14 00:55:14 +11:00
parent 6963cc1e40
commit 63a47ef7bb

View File

@ -106,6 +106,10 @@ t.ensureBlock = function (node) {
};
t.toStatement = function (node, ignore) {
if (t.isStatement(node)) {
return node;
}
var mustHaveId = false;
var newType;
@ -115,8 +119,6 @@ t.toStatement = function (node, ignore) {
} else if (t.isFunction(node)) {
mustHaveId = true;
newType = "FunctionDeclaration";
} else if (t.isStatement(node)) {
newType = node.type;
}
if (mustHaveId && !node.id) {