branch: master commit 24694401ec6479a5e59425b010f57b69cf15bafb Author: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com> Commit: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>
Fix bug where properties where checked for strict mode compliance --- js2-mode.el | 5 ++++- tests/parser.el | 3 +++ 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/js2-mode.el b/js2-mode.el index 89e18ab..48a2c77 100644 --- a/js2-mode.el +++ b/js2-mode.el @@ -9668,7 +9668,10 @@ If NODE is non-nil, it is the AST node associated with the symbol." ;; tt express assignment (=, |=, ^=, ..., %=) (setq op-pos (- (js2-current-token-beg) pos) ; relative left pn) - (js2-check-strict-identifier left) + ;; The assigned node could be a js2-prop-get-node (foo.bar = 0), we only + ;; care about assignment to strict variable names. + (when (js2-name-node-p left) + (js2-check-strict-identifier left)) (setq right (js2-parse-assign-expr) pn (make-js2-assign-node :type tt :pos pos diff --git a/tests/parser.el b/tests/parser.el index b9c9c68..bfc5653 100644 --- a/tests/parser.el +++ b/tests/parser.el @@ -281,6 +281,9 @@ the test." "'use strict';\narguments = 'fufufu';" :syntax-error "arguments" :errors-count 1) +(js2-deftest-parse function-property-strict-assignment + "'use strict';\narguments.okay = 'alright';") + (js2-deftest-parse function-strict-with "'use strict';\nwith ({}) {}" :syntax-error "with" :errors-count 1)