Merge pull request #3111 from daumantas-kavolis-sensmetry/patch-1

Fix regression in `subtree_compare`
This commit is contained in:
Max Brunsfeld 2024-02-29 07:51:34 -08:00 committed by GitHub
commit 36397810e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -629,9 +629,9 @@ int ts_subtree_compare(Subtree left, Subtree right, SubtreePool *pool) {
int result = 0;
if (ts_subtree_symbol(left) < ts_subtree_symbol(right)) result = -1;
if (ts_subtree_symbol(right) < ts_subtree_symbol(left)) result = 1;
if (ts_subtree_child_count(left) < ts_subtree_child_count(right)) result = -1;
if (ts_subtree_child_count(right) < ts_subtree_child_count(left)) result = 1;
else if (ts_subtree_symbol(right) < ts_subtree_symbol(left)) result = 1;
else if (ts_subtree_child_count(left) < ts_subtree_child_count(right)) result = -1;
else if (ts_subtree_child_count(right) < ts_subtree_child_count(left)) result = 1;
if (result != 0) {
array_clear(&pool->tree_stack);
return result;