Code coverage report for 6to5/transformation/transformers/es6-rest-parameters.js

Statements: 100% (12 / 12)      Branches: 100% (4 / 4)      Functions: 100% (1 / 1)      Lines: 100% (11 / 11)      Ignored: none     

All files » 6to5/transformation/transformers/ » es6-rest-parameters.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 231   1 492   7 7   7   7   7 2     7   7        
var t = require("../../types");
 
exports.Function = function (node, parent, file) {
  if (!node.rest) return;
 
  var rest = node.rest;
  delete node.rest;
 
  t.ensureBlock(node);
 
  var call = file.toArray(t.identifier("arguments"));
 
  if (node.params.length) {
    call.arguments.push(t.literal(node.params.length));
  }
 
  call._ignoreAliasFunctions = true;
 
  node.body.body.unshift(t.variableDeclaration("var", [
    t.variableDeclarator(rest, call)
  ]));
};