Fix incorrect parent values after call to child_by_field_name
Refs tree-sitter/node-tree-sitter#61 Refs tree-sitter/tree-sitter-javascript#127
This commit is contained in:
parent
21175142af
commit
35f82ce301
2 changed files with 16 additions and 1 deletions
|
|
@ -150,7 +150,9 @@ 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) {
|
||||
ts_tree_set_cached_parent(self.tree, &child, &self);
|
||||
if (ts_node__is_relevant(self, true)) {
|
||||
ts_tree_set_cached_parent(self.tree, &child, &self);
|
||||
}
|
||||
return child;
|
||||
}
|
||||
index++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue