better closure variable name in default parameters

This commit is contained in:
Sebastian McKenzie
2014-12-06 00:00:09 +11:00
parent ab02231d39
commit 67cfdbd447

View File

@@ -11,7 +11,7 @@ exports.Function = function (node, parent, file, scope) {
return t.getIds(param);
});
var closure = false;
var iife = false;
_.each(node.defaults, function (def, i) {
if (!def) return;
@@ -29,7 +29,7 @@ exports.Function = function (node, parent, file, scope) {
}
if (scope.has(node.name)) {
closure = true;
iife = true;
}
};
@@ -40,7 +40,7 @@ exports.Function = function (node, parent, file, scope) {
// we're accessing a variable that's already defined within this function
var has = scope.get(param.name);
if (has && !_.contains(node.params, has)) {
closure = true;
iife = true;
}
});
@@ -55,7 +55,7 @@ exports.Function = function (node, parent, file, scope) {
}, true));
});
if (closure) {
if (iife) {
var container = t.functionExpression(null, [], node.body, node.generator);
container._aliasFunction = true;