Fix tree-balancing logic
Remove incorrect condition that would prevent balancing of repeating structures containing only tokens (nodes w/ no children). Co-Authored-By: Rob Rix <robrix@github.com> Co-Authored-By: Patrick Thomson <patrickt@users.noreply.github.com>
This commit is contained in:
parent
70e2a2c025
commit
9ffcb16392
2 changed files with 7 additions and 10 deletions
|
|
@ -206,6 +206,10 @@ static inline uint32_t ts_subtree_child_count(Subtree self) {
|
|||
return self.data.is_inline ? 0 : self.ptr->child_count;
|
||||
}
|
||||
|
||||
static inline uint32_t ts_subtree_repeat_depth(Subtree self) {
|
||||
return self.data.is_inline ? 0 : self.ptr->repeat_depth;
|
||||
}
|
||||
|
||||
static inline uint32_t ts_subtree_node_count(Subtree self) {
|
||||
return (self.data.is_inline || self.ptr->child_count == 0) ? 1 : self.ptr->node_count;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue