Add unit test for child_by_field_name w/ hidden nodes
This commit is contained in:
parent
038f4fcef8
commit
73e252e39b
2 changed files with 35 additions and 6 deletions
|
|
@ -561,11 +561,14 @@ recur:
|
|||
return child;
|
||||
}
|
||||
|
||||
// If the field refers to a hidden node, return its first visible
|
||||
// child.
|
||||
// If the field refers to a hidden node with visible children,
|
||||
// return the first visible child.
|
||||
else if (ts_node_child_count(child) > 0 ) {
|
||||
return ts_node_child(child, 0);
|
||||
}
|
||||
|
||||
// Otherwise, continue searching subsequent children.
|
||||
else {
|
||||
TSNode result = ts_node_child(child, 0);
|
||||
if (result.id) return result;
|
||||
field_map++;
|
||||
if (field_map == field_map_end) return ts_node__null();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue