]> git.eshelyaron.com Git - emacs.git/commit
Handle signals gracefully in tree-sitter query predicates
authorYuan Fu <casouri@gmail.com>
Fri, 24 Mar 2023 19:19:25 +0000 (12:19 -0700)
committerYuan Fu <casouri@gmail.com>
Fri, 24 Mar 2023 19:29:33 +0000 (12:29 -0700)
commita37f19b14a6b51fa794178095cf56c112a1396e8
tree8790a9daf25c1a0925893a9945cdc8ba53474c45
parentf446bfc8198f34d3fc1fa08150383865929ff61c
Handle signals gracefully in tree-sitter query predicates

Before this change, predicate functions can signal, which will cause
Ftreesit_query_capture to skip freeing the query and cursor object.
We make predicate functions return the signal data rather than
directly signal.

* src/treesit.c (treesit_predicate_capture_name_to_node)
(treesit_predicate_capture_name_to_text)
(treesit_predicate_equal)
(treesit_predicate_match)
(treesit_predicate_pred)
(treesit_eval_predicates): Return signal rather than signaling
directly.
(Ftreesit_query_capture): Check for returned signal data.
src/treesit.c