branch: master commit 1f063011a24d01b51e8d19fdeb7f6e1fc2686872 Author: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com> Commit: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>
Pass property lookup test. --- context-coloring.el | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/context-coloring.el b/context-coloring.el index b6531bf..283bddd 100644 --- a/context-coloring.el +++ b/context-coloring.el @@ -227,6 +227,7 @@ END (exclusive) with the face corresponding to LEVEL." ;;; js2-mode colorization +;; TODO: Consider `js2-node-top-level-decl-p' as an optimization. (defsubst context-coloring-js2-scope-level (scope) "Gets the level of SCOPE." (let ((level 0) @@ -249,7 +250,10 @@ variable." (and (js2-name-node-p node) (let ((parent (js2-node-parent node))) (not (or (js2-object-prop-node-p parent) - (js2-prop-get-node-p parent)))))) + (and (js2-prop-get-node-p parent) + ;; For nested property lookup, the node on the left is a + ;; `js2-prop-get-node', so this always works. + (eq node (js2-prop-get-node-right parent)))))))) (defsubst context-coloring-js2-colorize-node (node level) "Colors NODE with the color for LEVEL." @@ -267,7 +271,6 @@ 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