[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7001dce 201/271: Use js2-node-top-level-decl-p as a fast t
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master 7001dce 201/271: Use js2-node-top-level-decl-p as a fast track. |
Date: |
Thu, 05 Feb 2015 18:31:12 +0000 |
branch: master
commit 7001dce7252ec4a85f6613082223b13bd3ea6f58
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Use js2-node-top-level-decl-p as a fast track.
---
context-coloring.el | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index 283bddd..7005dcf 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -227,7 +227,6 @@ 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)
@@ -244,6 +243,15 @@ END (exclusive) with the face corresponding to LEVEL."
(setq scope enclosing-scope))
level))
+(defsubst context-coloring-js2-name-node-level (node)
+ (cond ((js2-node-top-level-decl-p node)
+ 0)
+ (t
+ (context-coloring-js2-scope-level
+ (js2-get-defining-scope
+ (js2-node-get-enclosing-scope node)
+ (js2-name-node-name node))))))
+
(defsubst context-coloring-js2-local-name-node-p (node)
"Determines if NODE is a js2-name-node representing a local
variable."
@@ -283,10 +291,7 @@ generated by js2-mode."
((context-coloring-js2-local-name-node-p node)
(context-coloring-js2-colorize-node
node
- (context-coloring-js2-scope-level
- (js2-get-defining-scope
- (js2-node-get-enclosing-scope node)
- (js2-name-node-name node))))))
+ (context-coloring-js2-name-node-level node))))
;; The `t' indicates to search children.
t)))))
- [elpa] master cae3b72 240/271: Document new dispatch API., (continued)
- [elpa] master cae3b72 240/271: Document new dispatch API., Jackson Ray Hamilton, 2015/02/05
- [elpa] master fedf885 269/271: Add note to readme about --version., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d1715b2 177/271: Remove .gitignore entry., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 6e5e95a 211/271: Pass key-value pair test., Jackson Ray Hamilton, 2015/02/05
- [elpa] master bbebea1 253/271: Merge branch 'develop', Jackson Ray Hamilton, 2015/02/05
- [elpa] master 7059157 187/271: Add note on byte compilation., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 8300976 244/271: Merge branch 'master' into develop, Jackson Ray Hamilton, 2015/02/05
- [elpa] master 9a883e2 217/271: Version 2.1.0., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 34fb7e9 267/271: Fix readme link., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 9fdc037 243/271: Merge branch 'develop', Jackson Ray Hamilton, 2015/02/05
- [elpa] master 7001dce 201/271: Use js2-node-top-level-decl-p as a fast track.,
Jackson Ray Hamilton <=
- [elpa] master 221b583 156/271: Update hooking strategy., Jackson Ray Hamilton, 2015/02/05
- [elpa] master e2ee311 183/271: Fix timer existence check., Jackson Ray Hamilton, 2015/02/05
- [elpa] master a2ba1ef 213/271: Version 2.0.1., Jackson Ray Hamilton, 2015/02/05
- [elpa] master bef41e1 205/271: Merge branch 'feature/optimize-js2-mode' into develop, Jackson Ray Hamilton, 2015/02/05
- [elpa] master a14be3c 270/271: Merge commit 'fedf88552990afa269366dfa4c3f5af6d1cdb7c2' from context-coloring, Jackson Ray Hamilton, 2015/02/05
- [elpa] master 32fa415 226/271: Use `font-lock' for comments and strings., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 450aa85 236/271: Use macros to clean up tests., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 555820b 247/271: Merge branch 'master' into develop, Jackson Ray Hamilton, 2015/02/05
- [elpa] master 43bb3c1 261/271: Remove unnecessary file from .elpaignore., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 195fbe7 196/271: Improve assertion message., Jackson Ray Hamilton, 2015/02/05