]> git.eshelyaron.com Git - emacs.git/commit
Improve parameter checking in tree-sitter functions
authorYuan Fu <casouri@gmail.com>
Wed, 7 Dec 2022 03:56:25 +0000 (19:56 -0800)
committerYuan Fu <casouri@gmail.com>
Wed, 7 Dec 2022 20:01:37 +0000 (12:01 -0800)
commitd31a25398347f1646b0c37a27f82ac3771a7cc15
tree9bfa28a766714fdd6e6cebab4c88a444eb2c6fd5
parenta669d5fae54ad31fe65c2e285124bf90f900a08f
Improve parameter checking in tree-sitter functions

* src/treesit.c (treesit_check_position): Extract out new function.
(Ftreesit_node_first_child_for_pos)
(Ftreesit_node_descendant_for_range): Replace code with the new
function.
(Ftreesit_query_capture): Add missing check for node and parser.  Add
check for range for BEG and END.  Move treesit_initialize to the
beginning of the function.

* test/src/treesit-tests.el (treesit-node-api)
(treesit-query-api): Add tests for out-of-range error.
src/treesit.c
test/src/treesit-tests.el