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

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

[elpa] master 4a1b4e8 09/22: Parse without error first method in a class


From: Dmitry Gutov
Subject: [elpa] master 4a1b4e8 09/22: Parse without error first method in a class with keyword name
Date: Fri, 24 Apr 2015 02:57:11 +0000

branch: master
commit 4a1b4e8d089724445c01278247a6bfebe1d54009
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Parse without error first method in a class with keyword name
    
    Make 'static' just a reserved word, for now. Traceur calls it that anyway.
    
    Using js2-match-token was a problem because it stored a wrong token in
    js2-ti-tokens (read without the modifier).
    
    Fixes #216
---
 js2-mode.el |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 7314c28..1a7a852 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -650,11 +650,10 @@ which doesn't seem particularly useful, but Rhino permits 
it."
 (defvar js2-ARROW 162)         ; function arrow (=>)
 (defvar js2-CLASS 163)
 (defvar js2-EXTENDS 164)
-(defvar js2-STATIC 165)
-(defvar js2-SUPER 166)
-(defvar js2-TEMPLATE_HEAD 167)    ; part of template literal before 
substitution
-(defvar js2-NO_SUBS_TEMPLATE 168) ; template literal without substitutions
-(defvar js2-TAGGED_TEMPLATE 169)  ; tagged template literal
+(defvar js2-SUPER 165)
+(defvar js2-TEMPLATE_HEAD 166)    ; part of template literal before 
substitution
+(defvar js2-NO_SUBS_TEMPLATE 167) ; template literal without substitutions
+(defvar js2-TAGGED_TEMPLATE 168)  ; tagged template literal
 
 (defconst js2-num-tokens (1+ js2-TAGGED_TEMPLATE))
 
@@ -5690,7 +5689,7 @@ into temp buffers."
     let
     new null
     return
-    static super switch
+    super switch
     this throw true try typeof
     var void
     while with
@@ -5711,7 +5710,7 @@ into temp buffers."
                js2-LET
                js2-NEW js2-NULL
                js2-RETURN
-               js2-STATIC js2-SUPER js2-SWITCH
+               js2-SUPER js2-SWITCH
                js2-THIS js2-THROW js2-TRUE js2-TRY js2-TYPEOF
                js2-VAR
                js2-WHILE js2-WITH
@@ -5736,7 +5735,7 @@ The values are default faces to use for highlighting the 
keywords.")
 
 ;; FIXME: Support strict mode-only future reserved words, after we know
 ;; which parts scopes are in strict mode, and which are not.
-(defconst js2-reserved-words '(class enum export extends import super)
+(defconst js2-reserved-words '(class enum export extends import static super)
   "Future reserved keywords in ECMAScript 5.1.")
 
 (defconst js2-keyword-names
@@ -10321,9 +10320,14 @@ If ONLY-OF-P is non-nil, only the 'for (foo of bar)' 
form is allowed."
         (continue t)
         tt elems elem after-comma)
     (while continue
-      (setq static (and class-p (js2-match-token js2-STATIC))
-            tt (js2-get-prop-name-token)
+      (setq tt (js2-get-prop-name-token)
+            static nil
             elem nil)
+      (when (and class-p (= js2-NAME tt)
+                 (string= "static" (js2-current-token-string)))
+        (js2-record-face 'font-lock-keyword-face)
+        (setq static t
+              tt (js2-get-prop-name-token)))
       (cond
        ;; {foo: ...}, {'foo': ...}, {foo, bar, ...},
        ;; {get foo() {...}}, {set foo(x) {...}}, or {foo(x) {...}}



reply via email to

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