fix rest parameters in arrow functions containing wrong arguments reference - fixes #11
This commit is contained in:
@@ -35,6 +35,8 @@ var go = function (getBody, node, file) {
|
||||
}
|
||||
}
|
||||
|
||||
if (node._ignoreAliasFunctions) return;
|
||||
|
||||
var getId;
|
||||
|
||||
if (node.type === "Identifier" && node.name === "arguments") {
|
||||
|
||||
@@ -11,9 +11,14 @@ exports.Function = function (node, parent, file) {
|
||||
if (node.params.length) templateName += "-arg";
|
||||
|
||||
util.ensureBlock(node);
|
||||
node.body.body.unshift(util.template(templateName, {
|
||||
|
||||
var template = util.template(templateName, {
|
||||
SLICE_KEY: file.addDeclaration("slice"),
|
||||
VARIABLE_NAME: rest,
|
||||
SLICE_ARG: b.literal(node.params.length)
|
||||
}));
|
||||
});
|
||||
|
||||
template.declarations[0].init.arguments[0]._ignoreAliasFunctions = true;
|
||||
|
||||
node.body.body.unshift(template);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user