[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master a6f2a94 15/38: Allow plain parameters after default
From: |
Dmitry Gutov |
Subject: |
[elpa] master a6f2a94 15/38: Allow plain parameters after default |
Date: |
Wed, 09 Sep 2015 18:41:41 +0000 |
branch: master
commit a6f2a9410a441c272084e629b4307905f37431d1
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Allow plain parameters after default
https://bugzilla.mozilla.org/show_bug.cgi?id=777060
Fixes #257
---
js2-mode.el | 17 ++++-------------
tests/parser.el | 6 ++----
2 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/js2-mode.el b/js2-mode.el
index e4b4a55..c802a66 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -8041,7 +8041,7 @@ represented by FN-NODE at POS."
(eq (js2-current-token-type) js2-NAME)))
params param
param-name-nodes new-param-name-nodes
- default-found rest-param-at)
+ rest-param-at)
(when paren-free-arrow
(js2-unget-token))
(cl-loop for tt = (js2-peek-token)
@@ -8051,8 +8051,6 @@ represented by FN-NODE at POS."
((and (not paren-free-arrow)
(or (= tt js2-LB) (= tt js2-LC)))
(js2-get-token)
- (when default-found
- (js2-report-error "msg.no.default.after.default.param"))
(setq param (js2-parse-destruct-primary-expr)
new-param-name-nodes (js2-define-destruct-symbols
param js2-LP 'js2-function-param))
@@ -8074,14 +8072,8 @@ represented by FN-NODE at POS."
(js2-check-strict-function-params param-name-nodes (list
param))
(setq param-name-nodes (append param-name-nodes (list param)))
;; default parameter value
- (when (or (and default-found
- (not rest-param-at)
- (js2-must-match js2-ASSIGN
-
"msg.no.default.after.default.param"
- (js2-node-pos param)
- (js2-node-len param)))
- (and (>= js2-language-version 200)
- (js2-match-token js2-ASSIGN)))
+ (when (and (>= js2-language-version 200)
+ (js2-match-token js2-ASSIGN))
(cl-assert (not paren-free-arrow))
(let* ((pos (js2-node-pos param))
(tt (js2-current-token-type))
@@ -8091,8 +8083,7 @@ represented by FN-NODE at POS."
(len (- (js2-node-end right) pos)))
(setq param (make-js2-assign-node
:type tt :pos pos :len len :op-pos op-pos
- :left left :right right)
- default-found t)
+ :left left :right right))
(js2-node-add-children param left right)))
(push param params)))
(when (and rest-param-at (> (length params) (1+ rest-param-at)))
diff --git a/tests/parser.el b/tests/parser.el
index bfc5653..dc8c001 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -226,12 +226,10 @@ the test."
"function foo(a = 1, b = a + 1) {\n}")
(js2-deftest-parse function-with-no-default-after-default
- "function foo(a = 1, b) {\n}"
- :syntax-error "b")
+ "function foo(a = 1, b) {\n}")
(js2-deftest-parse function-with-destruct-after-default
- "function foo(a = 1, {b, c}) {\n}"
- :syntax-error "{")
+ "function foo(a = 1, {b, c}) {\n}")
(js2-deftest-parse function-with-rest-parameter
"function foo(a, b, ...rest) {\n}")
- [elpa] master c14fdf6 07/38: This shit is confusing, (continued)
- [elpa] master c14fdf6 07/38: This shit is confusing, Dmitry Gutov, 2015/09/09
- [elpa] master bb3f677 08/38: ..., Dmitry Gutov, 2015/09/09
- [elpa] master 4bd8df9 09/38: Revert the "containerized build" commits, because Travis still hasn't, Dmitry Gutov, 2015/09/09
- [elpa] master 9cdd4c6 10/38: -L ., Dmitry Gutov, 2015/09/09
- [elpa] master c47a894 11/38: Fix #247, indentation inside block comments, Dmitry Gutov, 2015/09/09
- [elpa] master 242af01 14/38: Handle @property like @param, and handle aliases, Dmitry Gutov, 2015/09/09
- [elpa] master c68646a 12/38: Never enable js2-minor-mode in js2-mode, Dmitry Gutov, 2015/09/09
- [elpa] master 5beb8ea 13/38: Define js2-re-search-forward as an alias as well, Dmitry Gutov, 2015/09/09
- [elpa] master fc56c58 16/38: js2-define-destruct-symbols-internal: Anticipate js2-getter-setter-node, Dmitry Gutov, 2015/09/09
- [elpa] master c8b8e11 19/38: js2-define-destruct-symbols: Speed up, theoretically, Dmitry Gutov, 2015/09/09
- [elpa] master a6f2a94 15/38: Allow plain parameters after default,
Dmitry Gutov <=
- [elpa] master d0686a0 18/38: js2-define-destruct-symbols-internal: Remove, don't need it anymore, Dmitry Gutov, 2015/09/09
- [elpa] master f146f13 17/38: js2-define-destruct-symbols-internal: Stop growing NAME-NODES exponentially, Dmitry Gutov, 2015/09/09
- [elpa] master eba59c5 21/38: Added missing etags dependency, Dmitry Gutov, 2015/09/09
- [elpa] master 7184664 20/38: Add a jump to definition command bound to M-., Dmitry Gutov, 2015/09/09
- [elpa] master bc5cdb4 23/38: Simplified property name matching, Dmitry Gutov, 2015/09/09
- [elpa] master 1ee5c45 22/38: Return correct node when searching for the definition of a property., Dmitry Gutov, 2015/09/09
- [elpa] master 579aacb 24/38: Simplified method of searching for nodes based on scope, Dmitry Gutov, 2015/09/09
- [elpa] master f942b83 26/38: Support jumping to buffers of the same major mode, Dmitry Gutov, 2015/09/09
- [elpa] master 145c5d6 25/38: Fixed jumping to object properties, Dmitry Gutov, 2015/09/09
- [elpa] master bb0476c 29/38: Clarified js2-search-scope doc string, Dmitry Gutov, 2015/09/09