optimise types.toStatement for when we're directly passed a statement
This commit is contained in:
parent
6963cc1e40
commit
63a47ef7bb
@ -106,6 +106,10 @@ t.ensureBlock = function (node) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
t.toStatement = function (node, ignore) {
|
t.toStatement = function (node, ignore) {
|
||||||
|
if (t.isStatement(node)) {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
var mustHaveId = false;
|
var mustHaveId = false;
|
||||||
var newType;
|
var newType;
|
||||||
|
|
||||||
@ -115,8 +119,6 @@ t.toStatement = function (node, ignore) {
|
|||||||
} else if (t.isFunction(node)) {
|
} else if (t.isFunction(node)) {
|
||||||
mustHaveId = true;
|
mustHaveId = true;
|
||||||
newType = "FunctionDeclaration";
|
newType = "FunctionDeclaration";
|
||||||
} else if (t.isStatement(node)) {
|
|
||||||
newType = node.type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mustHaveId && !node.id) {
|
if (mustHaveId && !node.id) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user