Fix compiler panic with init in a component inlined into a repeater

The problem was that the code from #4322 inlined the init code in the
parent Component as at that point, the per-repeater component don't
exist yet.
Fix it by removing the workaround from #4322, but changing the order of
the passes so that the init code are already proccessed before any
inlining. This required to change the order of a bunch of passes.

Fixes #5146

As a drive-by, also add the missing C++ implementation of set_animated_value
for Brush that was discovered by the test. (Code wouldn't compile)
This commit is contained in:
Olivier Goffart 2024-04-29 15:34:12 +02:00 committed by GitHub
parent 6e7353cf11
commit 12d904a71c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 75 additions and 32 deletions

View file

@ -92,6 +92,13 @@ pub async fn run_passes(
diag,
);
lower_tabwidget::lower_tabwidget(component, type_loader, diag).await;
}
collect_subcomponents::collect_subcomponents(root_component);
for component in (root_component.used_types.borrow().sub_components.iter())
.chain(std::iter::once(root_component))
{
apply_default_properties_from_style::apply_default_properties_from_style(
component,
&style_metrics,
@ -99,6 +106,9 @@ pub async fn run_passes(
);
lower_states::lower_states(component, &doc.local_registry, diag);
lower_text_input_interface::lower_text_input_interface(component);
repeater_component::process_repeater_components(component);
lower_popups::lower_popups(component, &doc.local_registry, diag);
collect_init_code::collect_init_code(component);
}
inlining::inline(doc, inlining::InlineSelection::InlineOnlyRequiredComponents);
@ -113,8 +123,6 @@ pub async fn run_passes(
{
border_radius::handle_border_radius(component, diag);
flickable::handle_flickable(component, &global_type_registry.borrow());
repeater_component::process_repeater_components(component);
lower_popups::lower_popups(component, &doc.local_registry, diag);
lower_component_container::lower_component_container(component, &doc.local_registry, diag);
lower_layout::lower_layouts(component, type_loader, diag).await;
@ -169,7 +177,6 @@ pub async fn run_passes(
if type_loader.compiler_config.accessibility {
lower_accessibility::lower_accessibility_properties(component, diag);
}
collect_init_code::collect_init_code(component);
materialize_fake_properties::materialize_fake_properties(component);
}
lower_layout::check_window_layout(root_component);