remove unnecessary strict helper

This commit is contained in:
Sebastian McKenzie 2015-05-31 23:40:59 +01:00
parent bfd307cd57
commit e42a43e3d1
2 changed files with 5 additions and 28 deletions

View File

@ -1,19 +0,0 @@
import * as t from "../../types";
export function has(node) {
var first = node.body[0];
return t.isExpressionStatement(first) && t.isLiteral(first.expression, { value: "use strict" });
}
export function wrap(node, callback) {
var useStrictNode;
if (has(node)) {
useStrictNode = node.body.shift();
}
callback();
if (useStrictNode) {
node.body.unshift(useStrictNode);
}
}

View File

@ -1,19 +1,15 @@
import * as strict from "../../helpers/strict";
export var metadata = { export var metadata = {
group: "builtin-modules" group: "builtin-modules"
}; };
export var Program = { export var Program = {
exit(program, parent, scope, file) { exit(program, parent, scope, file) {
strict.wrap(program, function () { // ensure that these are at the top, just like normal imports
// ensure that these are at the top, just like normal imports for (var node of (file.dynamicImports: Array)) {
for (var node of (file.dynamicImports: Array)) { node._blockHoist = 3;
node._blockHoist = 3; }
}
program.body = file.dynamicImports.concat(program.body); program.body = file.dynamicImports.concat(program.body);
});
if (!file.transformers["es6.modules"].canTransform()) return; if (!file.transformers["es6.modules"].canTransform()) return;