remove TCOable check

This commit is contained in:
Sebastian McKenzie 2015-06-01 00:14:12 +01:00
parent e42a43e3d1
commit 6f5d16f397

View File

@ -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)]);
}