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

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

[elpa] master 6755fdb 194/271: Pass test for key names.


From: Jackson Ray Hamilton
Subject: [elpa] master 6755fdb 194/271: Pass test for key names.
Date: Thu, 05 Feb 2015 18:31:08 +0000

branch: master
commit 6755fdb2c353f3c3b5102ad14da1fcb6e19b556f
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>

    Pass test for key names.
---
 context-coloring.el |   17 ++++-------------
 1 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index ea62a28..b6531bf 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -243,23 +243,13 @@ END (exclusive) with the face corresponding to LEVEL."
       (setq scope enclosing-scope))
     level))
 
-;; Adapted from js2-refactor.el/js2r-vars.el.
-;; FIXME: This fails if there is whitespace between the name and the colon.
 (defsubst context-coloring-js2-local-name-node-p (node)
   "Determines if NODE is a js2-name-node representing a local
 variable."
   (and (js2-name-node-p node)
-       (let ((start (js2-node-abs-pos node)))
-         (and
-          (let ((end (+ start (js2-node-len node))))
-            (not (string-match "[\n\t ]*:" (buffer-substring-no-properties
-                                            end
-                                            (+ end 1)))))
-          (not (string-match "\\.[\n\t ]*" (buffer-substring-no-properties
-                                            (max 1 (- start 1)) ; 0 throws an
-                                                                ; error. "" 
will
-                                                                ; fail the 
test.
-                                            start)))))))
+       (let ((parent (js2-node-parent node)))
+         (not (or (js2-object-prop-node-p parent)
+                  (js2-prop-get-node-p parent))))))
 
 (defsubst context-coloring-js2-colorize-node (node level)
   "Colors NODE with the color for LEVEL."
@@ -277,6 +267,7 @@ generated by js2-mode."
      js2-mode-ast
      (lambda (node end-p)
        (when (null end-p)
+         ;; (message "%s" (js2-node-short-name node))
          (cond
           ((js2-comment-node-p node)
            (context-coloring-js2-colorize-node



reply via email to

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