Do the initialization in the same order in C++ and rust

First the parent component, then the properties.
This commit is contained in:
Olivier Goffart 2022-07-08 18:08:00 +02:00 committed by Olivier Goffart
parent 43ae3aa124
commit 1fac9b7ad0

View file

@ -1262,7 +1262,6 @@ fn generate_sub_component(
let mut subtrees_ranges_cases = Vec::new();
let mut subtrees_components_cases = Vec::new();
let mut subcomponent_init_code = Vec::new();
for sub in &component.sub_components {
let field_name = ident(&sub.name);
let local_tree_index: u32 = sub.index_in_tree as _;
@ -1281,7 +1280,7 @@ fn generate_sub_component(
format!("tree_index_of_first_child + {} - 1", local_index_of_first_child)
};
subcomponent_init_code.push(format!(
init.push(format!(
"this->{}.init(root, self_weak.into_dyn(), {}, {});",
field_name, global_index, global_children
));
@ -1452,7 +1451,6 @@ fn generate_sub_component(
));
}
init.extend(subcomponent_init_code);
init.extend(properties_init_code);
init.extend(component.init_code.iter().map(|e| compile_expression(&e.borrow(), &ctx)));