remove unnecessary strict helper
This commit is contained in:
parent
bfd307cd57
commit
e42a43e3d1
@ -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);
|
||||
}
|
||||
}
|
||||
@ -1,19 +1,15 @@
|
||||
import * as strict from "../../helpers/strict";
|
||||
|
||||
export var metadata = {
|
||||
group: "builtin-modules"
|
||||
};
|
||||
|
||||
export var Program = {
|
||||
exit(program, parent, scope, file) {
|
||||
strict.wrap(program, function () {
|
||||
// ensure that these are at the top, just like normal imports
|
||||
for (var node of (file.dynamicImports: Array)) {
|
||||
node._blockHoist = 3;
|
||||
}
|
||||
// ensure that these are at the top, just like normal imports
|
||||
for (var node of (file.dynamicImports: Array)) {
|
||||
node._blockHoist = 3;
|
||||
}
|
||||
|
||||
program.body = file.dynamicImports.concat(program.body);
|
||||
});
|
||||
program.body = file.dynamicImports.concat(program.body);
|
||||
|
||||
if (!file.transformers["es6.modules"].canTransform()) return;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user