From e5e4fa4120a35e2688655eb9346670ef25281cb1 Mon Sep 17 00:00:00 2001 From: Stephen Hicks Date: Thu, 9 Jun 2016 17:07:02 -0700 Subject: [PATCH] Add js2-mode-assume-strict custom variable This allows all files to be parsed as if 'use strict' were on top of every file, for the case of JS passed through compilers that assume strict input. Closes #341. --- js2-mode.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js2-mode.el b/js2-mode.el index 4d9bbf8da..a46423e60 100644 --- a/js2-mode.el +++ b/js2-mode.el @@ -277,6 +277,11 @@ end of the line, otherwise, at the beginning of the next line." :type 'boolean :group 'js2-mode) +(defcustom js2-mode-assume-strict nil + "Non-nil to start files in strict mode automatically." + :type 'boolean + :group 'js2-mode) + (defcustom js2-mode-show-strict-warnings t "Non-nil to emit Ecma strict-mode warnings. Some of the warnings can be individually disabled by other flags, @@ -7988,7 +7993,7 @@ Scanner should be initialized." js2-nesting-of-function 0 js2-labeled-stmt nil js2-recorded-identifiers nil ; for js2-highlight - js2-in-use-strict-directive nil) + js2-in-use-strict-directive js2-mode-assume-strict) (while (/= (setq tt (js2-get-token)) js2-EOF) (if (= tt js2-FUNCTION) (progn -- 2.39.2