emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 90a9056 10/22: ...or any following one


From: Dmitry Gutov
Subject: [elpa] master 90a9056 10/22: ...or any following one
Date: Fri, 24 Apr 2015 02:57:12 +0000

branch: master
commit 90a905698cebcb9ce3adae86ab4d6733c511c831
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    ...or any following one
    
    Likewise, js2-match-token scanned the next token with the wrong modifier.
    
    Instead of adding an optional argument, I've opted to use
    js2-get-prop-name-token, in order not to duplicate the version check.
    
    #216
---
 js2-mode.el     |   14 +++++++-------
 tests/parser.el |    3 +++
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 1a7a852..5424ff0 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -10367,13 +10367,13 @@ If ONLY-OF-P is non-nil, only the 'for (foo of bar)' 
form is allowed."
           (if elem (js2-node-set-prop elem 'STATIC t)
             (js2-report-error "msg.unexpected.static")))
       ;; Handle commas, depending on class-p.
-      (let ((comma (js2-match-token js2-COMMA)))
-        (if class-p
-            (if comma
-                (js2-report-error "msg.class.unexpected.comma"))
-          (if comma
-              (setq after-comma (js2-current-token-end))
-            (setq continue nil))))
+      (let ((tok (js2-get-prop-name-token)))
+        (if (eq tok js2-COMMA)
+            (if class-p
+                (js2-report-error "msg.class.unexpected.comma")
+              (setq after-comma (js2-current-token-end)))
+          (js2-unget-token)
+          (unless class-p (setq continue nil))))
       ;; Append any parsed element.
       (if elem (push elem elems)))       ; end loop
     (js2-must-match js2-RC "msg.no.brace.prop")
diff --git a/tests/parser.el b/tests/parser.el
index 4c9b467..d791d3f 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -683,6 +683,9 @@ the test."
 (js2-deftest-parse parse-super-keyword
   "class Foo {\n  constructor() {  super(42);\n}\n  foo() {  
super.foo();\n}\n}")
 
+(js2-deftest-parse parse-class-keywordlike-method
+  "class C {\n  delete() {}\n  if() {}\n}")
+
 ;;; Scopes
 
 (js2-deftest ast-symbol-table-includes-fn-node "function foo() {}"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]