Fix regression in subtree_compare

This commit is contained in:
Daumantas Kavolis 2024-02-29 10:15:58 +02:00 committed by GitHub
parent 6b2879144f
commit ce5afeb4b3
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;