[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e6cb7bf 15/33: with statements are syntax errors in strict
From: |
Dmitry Gutov |
Subject: |
[elpa] master e6cb7bf 15/33: with statements are syntax errors in strict mode |
Date: |
Sun, 12 Jul 2015 22:35:39 +0000 |
branch: master
commit e6cb7bfc53b100d484487850b18a82cc57464e4f
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
with statements are syntax errors in strict mode
---
js2-mode.el | 5 +++++
tests/parser.el | 6 ++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/js2-mode.el b/js2-mode.el
index 12801bb..d47fc80 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -1671,6 +1671,9 @@ the correct number of ARGS must be provided."
(js2-msg "msg.no.paren.after.with"
"missing ) after with-statement object")
+(js2-msg "msg.no.with.strict"
+ "with statements not allowed in strict mode")
+
(js2-msg "msg.no.paren.after.let"
"missing ( after let")
@@ -9141,6 +9144,8 @@ does not match an existing label, reports an error and
returns nil."
(defun js2-parse-with ()
"Parser for with-statement. Last matched token must be js2-WITH."
+ (when js2-in-use-strict-directive
+ (js2-report-error "msg.no.with.strict"))
(let ((pos (js2-current-token-beg))
obj body pn lp rp)
(if (js2-must-match js2-LP "msg.no.paren.with")
diff --git a/tests/parser.el b/tests/parser.el
index a3b693b..04a19c3 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -281,6 +281,12 @@ the test."
"'use strict';\narguments = 'fufufu';"
:syntax-error "arguments" :errors-count 1)
+;;; Strict syntax errors
+
+(js2-deftest-parse function-strict-with
+ "'use strict';\nwith ({}) {}"
+ :syntax-error "with" :errors-count 1)
+
;;; Spread operator
(js2-deftest-parse spread-in-array-literal
- [elpa] master 88d7565 11/33: Respect strict mode., (continued)
- [elpa] master 88d7565 11/33: Respect strict mode., Dmitry Gutov, 2015/07/12
- [elpa] master a5b586f 13/33: Test const scoping., Dmitry Gutov, 2015/07/12
- [elpa] master 254c78c 07/33: Highlight unused and/or uninitialized variables, Dmitry Gutov, 2015/07/12
- [elpa] master 1277c7d 12/33: Track script and function strict mode., Dmitry Gutov, 2015/07/12
- [elpa] master 498bcca 21/33: Fix refactoring regression., Dmitry Gutov, 2015/07/12
- [elpa] master 663efb1 24/33: Remove strict mode slots on nodes., Dmitry Gutov, 2015/07/12
- [elpa] master 6255edb 18/33: Cleanup, Dmitry Gutov, 2015/07/12
- [elpa] master ad4c5cc 20/33: Report the correct octal number error, Dmitry Gutov, 2015/07/12
- [elpa] master ac205a4 16/33: Octal syntax is an error in strict mode, Dmitry Gutov, 2015/07/12
- [elpa] master 7850d12 25/33: Cleanup, Dmitry Gutov, 2015/07/12
- [elpa] master e6cb7bf 15/33: with statements are syntax errors in strict mode,
Dmitry Gutov <=
- [elpa] master 46e1492 23/33: Reparse strict functions., Dmitry Gutov, 2015/07/12
- [elpa] master 1391f2e 22/33: setq inline, Dmitry Gutov, 2015/07/12
- [elpa] master f1edac7 19/33: Don't treat a block-scoped const as redeclaration, Dmitry Gutov, 2015/07/12
- [elpa] master c588e31 17/33: Duplicate object keys are an error in strict mode, Dmitry Gutov, 2015/07/12
- [elpa] master 2469440 26/33: Fix bug where properties where checked for strict mode compliance, Dmitry Gutov, 2015/07/12
- [elpa] master 12e5a21 28/33: Remove js2-current-indent, Dmitry Gutov, 2015/07/12
- [elpa] master 5b25da2 30/33: Add NEWS entry and bump version, Dmitry Gutov, 2015/07/12
- [elpa] master e0ecf99 14/33: Check identifiers in strict mode., Dmitry Gutov, 2015/07/12
- [elpa] master f3a899b 32/33: And actually update NEWS, Dmitry Gutov, 2015/07/12
- [elpa] master 53f3f52 31/33: Actually remove the macro, Dmitry Gutov, 2015/07/12