Enhance matching module with valid children tracking and code readability improvements

- Added a `validChildren` field to the `VCache` structure to track valid child instances during the matching process.
- Refactored the `cacheVirtual` function to improve readability by formatting parameters across multiple lines.
- Updated the `computePairCost` function to utilize the new `validChildren` field for more accurate cost calculations.
- Simplified the `matchChildren` function by removing redundant code and improving the handling of matched instances.
- Enhanced test cases for the `matchChildren` function to ensure consistent behavior and validate the new changes.

These updates improve the efficiency and clarity of the matching process, ensuring better performance and maintainability.
This commit is contained in:
Joe 2026-02-18 06:40:28 -06:00
parent b687c8862d
commit ddd47b9afa
9 changed files with 287 additions and 363 deletions

View file

@ -937,14 +937,14 @@ impl JobThreadContext {
let start = Instant::now();
let instance_context = InstanceContext::new();
let snapshot = match snapshot_from_vfs(&instance_context, &self.vfs, &self.project_file_path)
{
Ok(s) => s,
Err(e) => {
log::error!("Tree reconciliation snapshot error: {:?}", e);
return;
}
};
let snapshot =
match snapshot_from_vfs(&instance_context, &self.vfs, &self.project_file_path) {
Ok(s) => s,
Err(e) => {
log::error!("Tree reconciliation snapshot error: {:?}", e);
return;
}
};
let mut tree = self.tree.lock().unwrap();
let root_id = tree.get_root_id();