Code coverage report for 6to5/transformation/transformers/spec-block-hoist-functions.js

Statements: 100% (11 / 11)      Branches: 100% (4 / 4)      Functions: 100% (2 / 2)      Lines: 100% (10 / 10)      Ignored: none     

All files » 6to5/transformation/transformers/ » spec-block-hoist-functions.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 191   1 518   223 343 3 3     3 3   340        
var t = require("../../types");
 
exports.BlockStatement = function (node, parent) {
  if (t.isFunction(parent)) return;
 
  node.body = node.body.map(function (node) {
    if (t.isFunction(node)) {
      node.type = "FunctionExpression";
      var declar = t.variableDeclaration("let", [
        t.variableDeclarator(node.id, node)
      ]);
      declar._blockHoist = true;
      return declar;
    } else {
      return node;
    }
  });
};