feat: reverse iteration through node parents (#3214)

This commit is contained in:
vanaigr 2024-04-23 09:19:57 -05:00 committed by GitHub
parent 0f125e2d09
commit 90e0e28b95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 84 additions and 24 deletions

View file

@ -548,9 +548,16 @@ TSStateId ts_node_next_parse_state(TSNode self);
/**
* Get the node's immediate parent.
* Prefer [`ts_node_child_containing_descendant`] for
* iterating over the node's ancestors.
*/
TSNode ts_node_parent(TSNode self);
/**
* Get the node's child that contains `descendant`.
*/
TSNode ts_node_child_containing_descendant(TSNode self, TSNode descendant);
/**
* Get the node's child at the given index, where zero represents the first
* child.