From 6f5d16f397ada6d61c0271cb4adc7fd0f744e870 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 1 Jun 2015 00:14:12 +0100 Subject: [PATCH] remove TCOable check --- .../transformers/es6/tail-call.js | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/src/babel/transformation/transformers/es6/tail-call.js b/src/babel/transformation/transformers/es6/tail-call.js index cbe6ff95c2..462f475505 100644 --- a/src/babel/transformation/transformers/es6/tail-call.js +++ b/src/babel/transformation/transformers/es6/tail-call.js @@ -9,29 +9,12 @@ export var metadata = { group: "builtin-trailing" }; -export function CallExpression(node) { - var callee = this.get("callee"); - if (!callee.isIdentifier()) return; - - var binding = this.scope.getBinding(callee.node.name); - if (!binding) return; - - if (!binding.path.isFunction()) return; - if (binding.identifier !== binding.path.node.id) return; - - binding.path.setData("shouldTryTCO", true); +export function Func/*tion*/(node, parent, scope, file) { + if (node.generator || node.async) return; + var tailCall = new TailCallTransformer(this, scope, file); + tailCall.run(); } -export var Func/*tion*/ = { - exit(node, parent, scope, file) { - if (node.generator || node.async) return; - if (!this.getData("shouldTryTCO")) return; - - var tailCall = new TailCallTransformer(this, scope, file); - tailCall.run(); - } -}; - function returnBlock(expr) { return t.blockStatement([t.returnStatement(expr)]); }