[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master daed014 10/38: add support for trailing comma in function
From: |
Dmitry Gutov |
Subject: |
[elpa] master daed014 10/38: add support for trailing comma in function arguments |
Date: |
Wed, 28 Feb 2018 20:12:09 -0500 (EST) |
branch: master
commit daed014c0cb3465ed1163af22315fbc99d971e1f
Author: Oles Savluk <address@hidden>
Commit: Oles Savluk <address@hidden>
add support for trailing comma in function arguments
---
NEWS.md | 4 ++++
js2-mode.el | 4 +++-
tests/parser.el | 4 ++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/NEWS.md b/NEWS.md
index 51ff733..dcba655 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,9 @@
# History of user-visible changes
+## Next
+
+* Support for trailing comma in function arguments
+
## 2017-07-21
* Support for async arrow function without parentheses.
diff --git a/js2-mode.el b/js2-mode.el
index 3ce65de..fd1655a 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -10238,7 +10238,9 @@ Returns the list in reverse order. Consumes the
right-paren token."
(js2-unget-token)
(push (js2-parse-assign-expr) result)))
while
- (js2-match-token js2-COMMA))
+ (and (js2-match-token js2-COMMA)
+ (or (< js2-language-version 200)
+ (not (= js2-RP (js2-peek-token))))))
(js2-must-match js2-RP "msg.no.paren.arg")
result)))
diff --git a/tests/parser.el b/tests/parser.el
index ccacd01..173bbe9 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -106,6 +106,10 @@ the test."
(js2-deftest-parse function-statement
"function foo() {\n}")
+(js2-deftest-parse trailing-comma-in-function-arguments
+ "f(a, b,);"
+ :reference "f(a, b);")
+
(js2-deftest-parse function-statement-inside-block
"if (true) {\n function foo() {\n }\n}")
- [elpa] master updated (94c7628 -> a6c39c2), Dmitry Gutov, 2018/02/28
- [elpa] master 4daab44 03/38: remove stray message call, Dmitry Gutov, 2018/02/28
- [elpa] master b0f8f03 02/38: make sure to visit import clause children in order, Dmitry Gutov, 2018/02/28
- [elpa] master 3207e5c 05/38: correctly handle arrow functions in js2-node-parent-stmt, Dmitry Gutov, 2018/02/28
- [elpa] master 91c745a 04/38: Merge pull request #440 from felipeochoa/issue439, Dmitry Gutov, 2018/02/28
- [elpa] master daed014 10/38: add support for trailing comma in function arguments,
Dmitry Gutov <=
- [elpa] master 048da26 06/38: Merge pull request #442 from felipeochoa/arrowStatements, Dmitry Gutov, 2018/02/28
- [elpa] master 6cf9ea4 07/38: Add jsdoc highlighting for yield and yields, Dmitry Gutov, 2018/02/28
- [elpa] master 43306d1 08/38: Merge pull request #444 from felipeochoa/jsdoc-yield, Dmitry Gutov, 2018/02/28
- [elpa] master dd295e8 13/38: Merge pull request #461 from Fuco1/feature/add-object-property-access-face, Dmitry Gutov, 2018/02/28
- [elpa] master ce540d2 19/38: Merge pull request #465 from felipeochoa/jsdoc-abstract, Dmitry Gutov, 2018/02/28
- [elpa] master ba14eb8 16/38: [feat] add jsdoc @abstract and @virtual empty tags, Dmitry Gutov, 2018/02/28
- [elpa] master 4062ae4 22/38: [bugfix] Mark @type jsdoc tag as a typed tag not an arg tag, Dmitry Gutov, 2018/02/28
- [elpa] master 47dc8f2 25/38: [feat] add @typedef jsdoc highlighting support, Dmitry Gutov, 2018/02/28
- [elpa] master eba9797 26/38: Merge pull request #469 from felipeochoa/jsdoc-typedef, Dmitry Gutov, 2018/02/28
- [elpa] master 32c0491 15/38: Merge pull request #464 from felipeochoa/unary-node-pos, Dmitry Gutov, 2018/02/28