From def43190589c93fbc12e648e87aec16b9585d211 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 12 Nov 2014 00:32:30 +1100 Subject: [PATCH] stop _alias-functions transformer when hitting a function that's not an arrow function - fixes #145 --- lib/6to5/transformation/transformers/_alias-functions.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/6to5/transformation/transformers/_alias-functions.js b/lib/6to5/transformation/transformers/_alias-functions.js index 780c51b92b..2186fe4951 100644 --- a/lib/6to5/transformation/transformers/_alias-functions.js +++ b/lib/6to5/transformation/transformers/_alias-functions.js @@ -16,8 +16,7 @@ var go = function (getBody, node, file, scope) { // traverse the function and find all alias functions so we can alias // arguments and this if necessary traverse(node, function (node) { - var _aliasFunction = node._aliasFunction; - if (!_aliasFunction) { + if (!node._aliasFunction) { if (t.isFunction(node)) { // stop traversal of this node as it'll be hit again by this transformer return false; @@ -28,10 +27,8 @@ var go = function (getBody, node, file, scope) { // traverse all child nodes of this function and find arguments and this traverse(node, function (node, parent) { - if (_aliasFunction === "arrows") { - if (t.isFunction(node) && node._aliasFunction !== "arrows") { - return false; - } + if (t.isFunction(node) && node._aliasFunction !== "arrows") { + return false; } if (node._ignoreAliasFunctions) return;