add rest parameter comments
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user