Skip to content

Commit

Permalink
Fix computation of the item sub range
Browse files Browse the repository at this point in the history
We need to account for the repeater count in the item sub-range

(cherry picked from commit e04835d)
  • Loading branch information
ogoffart committed Sep 15, 2023
1 parent 1e74d8b commit ff0bb80
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/compiler/generator/cpp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1824,6 +1824,7 @@ fn generate_sub_component(
"}} else if (index >= {} && index < {}) {{",
sub.index_of_first_child_in_tree,
sub.index_of_first_child_in_tree + sub_items_count - 1
+ sub.ty.repeater_count()
));
code.push(format!(
" return self->{}.{name}(index - {}{forward_args});",
Expand Down
2 changes: 1 addition & 1 deletion internal/compiler/generator/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ fn generate_sub_component(
));
if sub_items_count > 1 {
let range_begin = local_index_of_first_child as usize;
let range_end = range_begin + sub_items_count - 2;
let range_end = range_begin + sub_items_count - 2 + sub.ty.repeater_count();
accessible_role_branch.push(quote!(
#range_begin..=#range_end => #sub_compo_field.apply_pin(_self).accessible_role(index - #range_begin + 1),
));
Expand Down

0 comments on commit ff0bb80

Please sign in to comment.