From 80764c214a65c1436d9f90db5b99f87710d32d6a Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Thu, 15 Jan 2015 19:52:53 +1100 Subject: [PATCH] add rest parameter comments --- lib/6to5/transformation/transformers/es6-rest-parameters.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/6to5/transformation/transformers/es6-rest-parameters.js b/lib/6to5/transformation/transformers/es6-rest-parameters.js index 266b6f62f7..68fe384992 100644 --- a/lib/6to5/transformation/transformers/es6-rest-parameters.js +++ b/lib/6to5/transformation/transformers/es6-rest-parameters.js @@ -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); }