rename useStrict transformer to strict
This commit is contained in:
parent
5ac4dc0541
commit
b7cb2bcb7b
@ -388,7 +388,7 @@ export default class File {
|
|||||||
var opts = this.opts;
|
var opts = this.opts;
|
||||||
|
|
||||||
opts.allowImportExportEverywhere = this.isLoose("es6.modules");
|
opts.allowImportExportEverywhere = this.isLoose("es6.modules");
|
||||||
opts.strictMode = this.transformers.useStrict.canRun();
|
opts.strictMode = this.transformers.strict.canRun();
|
||||||
|
|
||||||
return parse(opts, code, (tree) => {
|
return parse(opts, code, (tree) => {
|
||||||
this.transform(tree);
|
this.transform(tree);
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"useStrict": "strict",
|
||||||
"selfContained": "runtime",
|
"selfContained": "runtime",
|
||||||
"unicode-regex": "regex.unicode",
|
"unicode-regex": "regex.unicode",
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
export default {
|
export default {
|
||||||
useStrict: require("./other/use-strict"),
|
strict: require("./other/strict"),
|
||||||
|
|
||||||
"validation.undeclaredVariableCheck": require("./validation/undeclared-variable-check"),
|
"validation.undeclaredVariableCheck": require("./validation/undeclared-variable-check"),
|
||||||
"validation.noForInOfAssignment": require("./validation/no-for-in-of-assignment"),
|
"validation.noForInOfAssignment": require("./validation/no-for-in-of-assignment"),
|
||||||
@ -97,7 +97,7 @@ export default {
|
|||||||
"spec.typeofSymbol": require("./spec/typeof-symbol"),
|
"spec.typeofSymbol": require("./spec/typeof-symbol"),
|
||||||
"spec.undefinedToVoid": require("./spec/undefined-to-void"),
|
"spec.undefinedToVoid": require("./spec/undefined-to-void"),
|
||||||
|
|
||||||
_useStrict: require("./internal/use-strict"),
|
_strict: require("./internal/strict"),
|
||||||
_moduleFormatter: require("./internal/module-formatter"),
|
_moduleFormatter: require("./internal/module-formatter"),
|
||||||
|
|
||||||
"es3.propertyLiterals": require("./es3/property-literals"),
|
"es3.propertyLiterals": require("./es3/property-literals"),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import * as useStrict from "../../helpers/use-strict";
|
import * as strict from "../../helpers/use-strict";
|
||||||
import t from "../../../types";
|
import t from "../../../types";
|
||||||
|
|
||||||
export var secondPass = true;
|
export var secondPass = true;
|
||||||
@ -6,7 +6,7 @@ export var secondPass = true;
|
|||||||
export function BlockStatement(node, parent, scope, file) {
|
export function BlockStatement(node, parent, scope, file) {
|
||||||
if (!node._declarations) return;
|
if (!node._declarations) return;
|
||||||
|
|
||||||
useStrict.wrap(node, function () {
|
strict.wrap(node, function () {
|
||||||
var kinds = {};
|
var kinds = {};
|
||||||
var kind;
|
var kind;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import * as useStrict from "../../helpers/use-strict";
|
import * as strict from "../../helpers/strict";
|
||||||
|
|
||||||
export function Program(program, parent, scope, file) {
|
export function Program(program, parent, scope, file) {
|
||||||
if (!file.transformers["es6.modules"].canRun()) return;
|
if (!file.transformers["es6.modules"].canRun()) return;
|
||||||
|
|
||||||
useStrict.wrap(program, function () {
|
strict.wrap(program, function () {
|
||||||
program.body = file.dynamicImports.concat(program.body);
|
program.body = file.dynamicImports.concat(program.body);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import t from "../../../types";
|
import t from "../../../types";
|
||||||
|
|
||||||
export function Program(program, parent, scope, file) {
|
export function Program(program, parent, scope, file) {
|
||||||
if (file.transformers.useStrict.canRun()) {
|
if (file.transformers.strict.canRun()) {
|
||||||
program.body.unshift(t.expressionStatement(t.literal("use strict")));
|
program.body.unshift(t.expressionStatement(t.literal("use strict")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user