From 63a47ef7bb6960531cd3ba302c112c7191e5ee2c Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 14 Nov 2014 00:55:14 +1100 Subject: [PATCH] optimise types.toStatement for when we're directly passed a statement --- lib/6to5/types/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/6to5/types/index.js b/lib/6to5/types/index.js index 918268d418..c921215e4f 100644 --- a/lib/6to5/types/index.js +++ b/lib/6to5/types/index.js @@ -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) {