Function: c-ts-common--node-is
c-ts-common--node-is is a byte-compiled function defined in
c-ts-common.el.gz.
Signature
(c-ts-common--node-is NODE &rest TYPES)
Documentation
Return non-nil if NODE is any one of the TYPES.
TYPES can be any of if, else, while, do, for, and
block.
If NODE is nil, return nil.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/c-ts-common.el.gz
(defun c-ts-common--node-is (node &rest types)
"Return non-nil if NODE is any one of the TYPES.
TYPES can be any of `if', `else', `while', `do', `for', and
`block'.
If NODE is nil, return nil."
(declare (indent 2))
(catch 'ret
(when (null node)
(throw 'ret nil))
(dolist (type types)
(let ((regexp (alist-get
type c-ts-common-indent-type-regexp-alist))
(parent (treesit-node-parent node)))
(when (and regexp
(if (consp regexp)
(and parent
(string-match-p (car regexp)
(treesit-node-type parent))
(treesit-node-field-name node)
(string-match-p (cdr regexp)
(treesit-node-field-name
node)))
(string-match-p regexp (treesit-node-type node))))
(throw 'ret t))))
nil))