Code coverage report for 6to5/transformation/transformers/_declarations.js

Statements: 100% (14 / 14)      Branches: 100% (6 / 6)      Functions: 100% (1 / 1)      Lines: 100% (14 / 14)      Ignored: none     

All files » 6to5/transformation/transformers/ » _declarations.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 261   1   1072 1072   1072 71   71 71   71 8 8   63       1072 4      
var t = require("../../types");
 
exports.BlockStatement =
exports.Program = function (node) {
  var kinds = {};
  var kind;
 
  for (var i in node._declarations) {
    var declar = node._declarations[i];
 
    kind = declar.kind || "var";
    var declarNode = t.variableDeclarator(declar.id, declar.init);
 
    if (!declar.init) {
      kinds[kind] = kinds[kind] || [];
      kinds[kind].push(declarNode);
    } else {
      node.body.unshift(t.variableDeclaration(kind, [declarNode]));
    }
  }
 
  for (kind in kinds) {
    node.body.unshift(t.variableDeclaration(kind, kinds[kind]));
  }
};