Use single if block

This commit is contained in:
Daumantas Kavolis 2023-10-25 10:47:55 +03:00
parent e26e23fd0e
commit 143ed959c9
No known key found for this signature in database
GPG key ID: 67197B110409498E

View file

@ -378,14 +378,14 @@ TreeCursorStep ts_tree_cursor_goto_previous_sibling_internal(TSTreeCursor *_self
uint32_t child_index = array_back(&self->stack)->child_index;
const Subtree *children = ts_subtree_children((*(parent->subtree)));
// skip first child padding since its position should match the position of the parent
if (child_index > 0)
if (child_index > 0) {
// skip first child padding since its position should match the position of the parent
position = length_add(position, ts_subtree_size(children[0]));
for (uint32_t i = 1; i < child_index; ++i) {
position = length_add(position, ts_subtree_total_size(children[i]));
}
if (child_index > 0)
for (uint32_t i = 1; i < child_index; ++i) {
position = length_add(position, ts_subtree_total_size(children[i]));
}
position = length_add(position, ts_subtree_padding(children[child_index]));
}
array_back(&self->stack)->position = position;