Refactor matching logic for improved readability and consistency

- Simplified function calls in `Reconciler/matching.lua` by consolidating multi-line arguments into single lines, enhancing code clarity.
- Updated `matching.rs` to improve formatting of method calls and assertions, ensuring a more consistent style throughout the test suite.
- Enhanced the `matching_fixtures.rs` file by streamlining the loading of input data and improving the readability of child copying logic.

These changes contribute to a cleaner and more maintainable codebase, facilitating easier future modifications.
This commit is contained in:
Joe 2026-02-17 18:38:09 -06:00
parent 21b3ee45fd
commit 6ef81cf8e0
3 changed files with 28 additions and 40 deletions

View file

@ -301,9 +301,7 @@ function Matching._computeChildrenCost(
local cost = 0
for _, pair in childResult.matched do
cost += Matching._computeChangeCount(
pair.virtualId, pair.studioInstance, virtualInstances, bestSoFar - cost
)
cost += Matching._computeChangeCount(pair.virtualId, pair.studioInstance, virtualInstances, bestSoFar - cost)
if cost >= bestSoFar then
return cost
end
@ -527,9 +525,7 @@ function Matching.matchChildren(
local sCaches: { [number]: any } = {}
for _, si in sIndices do
if not matchedS2[si] then
sCaches[si] = Matching._cacheStudio(
remainingStudio[si], classKeys, extraPropNamesArray
)
sCaches[si] = Matching._cacheStudio(remainingStudio[si], classKeys, extraPropNamesArray)
end
end
@ -569,9 +565,7 @@ function Matching.matchChildren(
-- Recursive children cost
local vInst = virtualInstances[remainingVirtual[vi]]
if vInst then
cost += Matching._computeChildrenCost(
vInst, sCache, virtualInstances, bestSoFar - cost
)
cost += Matching._computeChildrenCost(vInst, sCache, virtualInstances, bestSoFar - cost)
end
end