nice alias function definitions
This commit is contained in:
@@ -17,7 +17,8 @@ var go = function (getBody, node, file) {
|
||||
// traverse the function and find all alias functions so we can alias
|
||||
// arguments and this if neccesary
|
||||
traverse(node, function (node) {
|
||||
if (!node._aliasFunction) {
|
||||
var _aliasFunction = node._aliasFunction;
|
||||
if (!_aliasFunction) {
|
||||
if (traverse.isFunction(node)) {
|
||||
// stop traversal of this node as it'll be hit again by this transformer
|
||||
return false;
|
||||
@@ -39,7 +40,7 @@ var go = function (getBody, node, file) {
|
||||
}
|
||||
|
||||
if (util.isReferenced(node, parent)) return getId();
|
||||
}, node._aliasFunctionStopNonArrowFunctions && ["FunctionExpression", "FunctionDeclaration"]);
|
||||
}, _aliasFunction === "arrows" && ["FunctionExpression", "FunctionDeclaration"]);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -3,8 +3,7 @@ var util = require("../util");
|
||||
exports.ArrowFunctionExpression = function (node) {
|
||||
util.ensureBlock(node);
|
||||
|
||||
node._aliasFunction = true;
|
||||
node._aliasFunctionStopNonArrowFunctions = true;
|
||||
node._aliasFunction = "arrows";
|
||||
node.expression = false;
|
||||
node.type = "FunctionExpression";
|
||||
|
||||
|
||||
@@ -44,8 +44,7 @@ exports.ObjectExpression = function (node, parent, file) {
|
||||
var containerCallee = container.callee;
|
||||
var containerBody = containerCallee.body.body;
|
||||
|
||||
containerCallee._aliasFunction = true;
|
||||
containerCallee._aliasFunctionStopNonArrowFunctions = true;
|
||||
containerCallee._aliasFunction = "arrows";
|
||||
|
||||
_.each(computed, function (prop) {
|
||||
containerBody.unshift(util.template("obj-key-set", {
|
||||
|
||||
Reference in New Issue
Block a user