Allocate parent nodes together with their child array
This commit is contained in:
parent
b972a7158d
commit
d533d1f076
9 changed files with 240 additions and 157 deletions
|
|
@ -53,7 +53,7 @@ static inline void reusable_node_advance(ReusableNode *self) {
|
|||
} while (ts_subtree_child_count(tree) <= next_index);
|
||||
|
||||
array_push(&self->stack, ((StackEntry) {
|
||||
.tree = tree.ptr->children[next_index],
|
||||
.tree = ts_subtree_children(tree)[next_index],
|
||||
.child_index = next_index,
|
||||
.byte_offset = byte_offset,
|
||||
}));
|
||||
|
|
@ -63,7 +63,7 @@ static inline bool reusable_node_descend(ReusableNode *self) {
|
|||
StackEntry last_entry = *array_back(&self->stack);
|
||||
if (ts_subtree_child_count(last_entry.tree) > 0) {
|
||||
array_push(&self->stack, ((StackEntry) {
|
||||
.tree = last_entry.tree.ptr->children[0],
|
||||
.tree = ts_subtree_children(last_entry.tree)[0],
|
||||
.child_index = 0,
|
||||
.byte_offset = last_entry.byte_offset,
|
||||
}));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue