From 62bc815f81850c4b7faee16fa890efd33b7ae198 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Thu, 29 Jan 2015 21:07:34 +1100 Subject: [PATCH] only set strictMode to true when the useStrict transformer is enabled --- lib/6to5/file.js | 1 + lib/6to5/util.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/6to5/file.js b/lib/6to5/file.js index 3cd89c2cf7..1780dff724 100644 --- a/lib/6to5/file.js +++ b/lib/6to5/file.js @@ -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); diff --git a/lib/6to5/util.js b/lib/6to5/util.js index fcb560ebe6..939148f257 100644 --- a/lib/6to5/util.js +++ b/lib/6to5/util.js @@ -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,