summaryrefslogtreecommitdiff
path: root/lisp/progmodes/js.el
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2022-12-29 11:34:28 -0800
committerYuan Fu <casouri@gmail.com>2022-12-29 11:34:51 -0800
commit793641a3db5e14cd2eeb251d2f473b1035192560 (patch)
tree12d0c8d081c797c61a94b2e486fe014f9242e80a /lisp/progmodes/js.el
parent0aea1cf8190aa804a0d11a67b4a3cb4b715ae82d (diff)
downloademacs-793641a3db5e14cd2eeb251d2f473b1035192560.tar.gz
; * lisp/progmodes/js.el: Fix byte-compile warning.
Diffstat (limited to 'lisp/progmodes/js.el')
-rw-r--r--lisp/progmodes/js.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 4dece11d1c1..0cc673a80ff 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -74,6 +74,8 @@
(declare-function treesit-node-start "treesit.c")
(declare-function treesit-node-end "treesit.c")
(declare-function treesit-node-type "treesit.c")
+(declare-function treesit-query-compile "treesit.c")
+(declare-function treesit-query-capture "treesit.c")
;;; Constants
@@ -3642,8 +3644,9 @@ OVERRIDE is the override flag described in
"call_expression")))
(defvar js--treesit-lhs-identifier-query
- (treesit-query-compile 'javascript '((identifier) @id
- (property_identifier) @id))
+ (when (treesit-available-p)
+ (treesit-query-compile 'javascript '((identifier) @id
+ (property_identifier) @id)))
"Query that captures identifier and query_identifier.")
(defun js--treesit-fontify-assignment-lhs (node override start end &rest _)