only set strictMode to true when the useStrict transformer is enabled

This commit is contained in:
Sebastian McKenzie
2015-01-29 21:07:34 +11:00
parent 4e68f94023
commit 62bc815f81
2 changed files with 2 additions and 1 deletions

View File

@@ -316,6 +316,7 @@ File.prototype.parse = function (code) {
var opts = this.opts;
opts.allowImportExportEverywhere = this.isLoose("es6.modules");
opts.strictMode = this.transformers.useStrict.canRun();
return util.parse(opts, code, function (tree) {
self.transform(tree);

View File

@@ -204,7 +204,7 @@ exports.parse = function (opts, code, callback) {
allowReturnOutsideFunction: true,
ecmaVersion: opts.experimental ? 7 : 6,
playground: opts.playground,
strictMode: true,
strictMode: opts.strictMode,
onComment: comments,
locations: true,
onToken: tokens,