alias functions in scope call wrapping - fixes #99

This commit is contained in:
Sebastian McKenzie
2014-10-28 10:58:20 +11:00
parent 5f9e954d21
commit 21ed438fd8

View File

@@ -42,9 +42,11 @@ exports.VariableDeclaration = function (node, parent, file) {
if (node.type === "FunctionDeclaration") {
throw new Error("`FunctionDeclaration`s that use `let` and `constant` references aren't allowed outside of the root scope");
} else {
return b.callExpression(b.functionExpression(null, letReferences, b.blockStatement([
var func = b.functionExpression(null, letReferences, b.blockStatement([
b.returnStatement(node)
])), letReferences);
]));
func._aliasFunction = true;
return b.callExpression(func, letReferences);
}
} else {
return false;