Merge branch 'nhasabni/ts_node_child_field_name' of https://github.com/nhasabni/tree-sitter into nhasabni/ts_node_child_field_name

This commit is contained in:
Niranjan Hasabnis 2021-05-20 23:37:03 +00:00
commit bd06b1a8b3
19 changed files with 56 additions and 99 deletions

View file

@ -150,9 +150,6 @@ static inline TSNode ts_node__child(
while (ts_node_child_iterator_next(&iterator, &child)) {
if (ts_node__is_relevant(child, include_anonymous)) {
if (index == child_index) {
if (ts_node__is_relevant(self, true)) {
ts_tree_set_cached_parent(self.tree, &child, &self);
}
return child;
}
index++;
@ -355,7 +352,6 @@ static inline TSNode ts_node__descendant_for_byte_range(
node = child;
if (ts_node__is_relevant(node, include_anonymous)) {
ts_tree_set_cached_parent(self.tree, &child, &last_visible_node);
last_visible_node = node;
}
did_descend = true;
@ -395,7 +391,6 @@ static inline TSNode ts_node__descendant_for_point_range(
node = child;
if (ts_node__is_relevant(node, include_anonymous)) {
ts_tree_set_cached_parent(self.tree, &child, &last_visible_node);
last_visible_node = node;
}
did_descend = true;
@ -464,10 +459,7 @@ bool ts_node_has_error(TSNode self) {
}
TSNode ts_node_parent(TSNode self) {
TSNode node = ts_tree_get_cached_parent(self.tree, &self);
if (node.id) return node;
node = ts_tree_root_node(self.tree);
TSNode node = ts_tree_root_node(self.tree);
uint32_t end_byte = ts_node_end_byte(self);
if (node.id == self.id) return ts_node__null();
@ -486,7 +478,6 @@ TSNode ts_node_parent(TSNode self) {
if (iterator.position.bytes >= end_byte) {
node = child;
if (ts_node__is_relevant(child, true)) {
ts_tree_set_cached_parent(self.tree, &node, &last_visible_node);
last_visible_node = node;
}
did_descend = true;