Update patch application logic to ensure correct resolution order for legacy and path-based references

- Added a comment to clarify the importance of resolving `Rojo_Target_*` before `Rojo_Ref_*` to ensure proper overwriting of results for the same property.
- This change aims to enhance the maintainability and correctness of the patch application process in the `finalize_patch_application` function.
This commit is contained in:
Joe 2026-02-18 23:17:06 -06:00
parent 9bb237f4eb
commit d3a9155e10
2 changed files with 188 additions and 3 deletions

View file

@ -124,9 +124,9 @@ fn finalize_patch_application(context: PatchApplyContext, tree: &mut RojoTree) -
}
}
// This is to get around the fact that `RojoTre::get_specified_id` borrows
// the tree as immutable, but we need to hold a mutable reference to it.
// Not exactly elegant, but it does the job.
// IMPORTANT: Rojo_Target_* (legacy) must be resolved BEFORE Rojo_Ref_*
// (path-based) so that path-based results overwrite legacy results when
// both exist for the same property. Do not reorder these two blocks.
let mut real_rewrites = Vec::new();
for (id, map) in context.attribute_refs_to_rewrite {
for (prop_name, prop_value) in map {