mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Refactor line change calculations in PatchTree.build function for improved readability and maintainability.
This commit is contained in:
parent
a9a9d930d3
commit
4caac7a31c
1 changed files with 5 additions and 2 deletions
|
|
@ -263,7 +263,8 @@ function PatchTree.build(patch, instanceMap, changeListHeaders)
|
||||||
-- Check if this is a Source property - count line differences
|
-- Check if this is a Source property - count line differences
|
||||||
if prop == "Source" and currentSuccess and incomingSuccess then
|
if prop == "Source" and currentSuccess and incomingSuccess then
|
||||||
hasSourceChange = true
|
hasSourceChange = true
|
||||||
totalLineChanges, whitespaceLineChanges = WhitespaceUtil.CountLineDifferences(currentValue, incomingValue)
|
totalLineChanges, whitespaceLineChanges =
|
||||||
|
WhitespaceUtil.CountLineDifferences(currentValue, incomingValue)
|
||||||
end
|
end
|
||||||
|
|
||||||
addProp(
|
addProp(
|
||||||
|
|
@ -279,7 +280,9 @@ function PatchTree.build(patch, instanceMap, changeListHeaders)
|
||||||
changeInfo = {
|
changeInfo = {
|
||||||
-- Line changes for Source (nil if no Source change)
|
-- Line changes for Source (nil if no Source change)
|
||||||
lineChanges = if hasSourceChange and totalLineChanges > 0 then totalLineChanges else nil,
|
lineChanges = if hasSourceChange and totalLineChanges > 0 then totalLineChanges else nil,
|
||||||
isWhitespaceOnly = hasSourceChange and totalLineChanges > 0 and totalLineChanges == whitespaceLineChanges,
|
isWhitespaceOnly = hasSourceChange
|
||||||
|
and totalLineChanges > 0
|
||||||
|
and totalLineChanges == whitespaceLineChanges,
|
||||||
-- Property changes (non-Source: Name, Attributes, etc.)
|
-- Property changes (non-Source: Name, Attributes, etc.)
|
||||||
propChanges = if propCount > 0 then propCount else nil,
|
propChanges = if propCount > 0 then propCount else nil,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue