branch: master commit 5c8855f3f27027d7f765d310fd71d61f658e1a03 Merge: 196a6ed 6e5e95a Author: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com> Commit: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>
Merge branch 'feature/key-values' into develop --- context-coloring.el | 3 ++- test/context-coloring-test.el | 17 +++++++++++++++++ test/fixtures/key-values.js | 8 ++++++++ 3 files changed, 27 insertions(+), 1 deletions(-) diff --git a/context-coloring.el b/context-coloring.el index bb3cb1e..ff3eae0 100644 --- a/context-coloring.el +++ b/context-coloring.el @@ -255,7 +255,8 @@ END (exclusive) with the face corresponding to LEVEL." variable." (and (js2-name-node-p node) (let ((parent (js2-node-parent node))) - (not (or (js2-object-prop-node-p parent) + (not (or (and (js2-object-prop-node-p parent) + (eq node (js2-object-prop-node-left 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. diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el index 3fa7953..52a93fb 100644 --- a/test/context-coloring-test.el +++ b/test/context-coloring-test.el @@ -235,4 +235,21 @@ invoke when it is done." "./fixtures/property-lookup.js" (context-coloring-test-js-property-lookup))) +(defun context-coloring-test-js-key-values () + (context-coloring-test-assert-region-level 78 79 1)) + +(ert-deftest-async context-coloring-test-js-mode-key-values (done) + (context-coloring-test-js-mode + "./fixtures/key-values.js" + (lambda (teardown) + (unwind-protect + (context-coloring-test-js-key-values) + (funcall teardown)) + (funcall done)))) + +(ert-deftest context-coloring-test-js2-mode-key-values () + (context-coloring-test-js2-mode + "./fixtures/key-values.js" + (context-coloring-test-js-key-values))) + (provide 'context-coloring-test) diff --git a/test/fixtures/key-values.js b/test/fixtures/key-values.js new file mode 100644 index 0000000..41bdedd --- /dev/null +++ b/test/fixtures/key-values.js @@ -0,0 +1,8 @@ +(function () { + var a; + (function () { + return { + b: a + }; + }()); +}());