add rest parameter comments

This commit is contained in:
Sebastian McKenzie
2015-01-15 19:52:53 +11:00
parent 55054e45da
commit 80764c214a

View File

@@ -10,6 +10,8 @@ exports.Function = function (node, parent, file) {
t.ensureBlock(node);
var argsId = t.identifier("arguments");
// otherwise `arguments` will be remapped in arrow functions
argsId._ignoreAliasFunctions = true;
var start = t.literal(node.params.length);
@@ -17,6 +19,9 @@ exports.Function = function (node, parent, file) {
var arrKey = key;
if (node.params.length) {
// this method has additional params, so we need to subtract
// the index of the current argument position from the
// position in the array that we want to populate
arrKey = t.binaryExpression("-", arrKey, start);
}