Skip to content

Commit a1d61c4

Browse files
fix: grow root mapping correctly
1 parent 4c55e2e commit a1d61c4

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

src/main/java/org/variantsync/vevos/extraction/PCAnalysis.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,18 @@ static void analyzeNode(FileGT.Mutable fileGT, DiffNode<DiffLinesLabel> node, Ti
5757
}
5858
int fromLine = currentRange.fromInclusive();
5959
int toLine = currentRange.toExclusive();
60+
// Also consider the #endif in case of an annotation
61+
toLine = (node.isAnnotation() && !node.isRoot()) ? toLine+1 : toLine;
6062

61-
if (node.isAnnotation()) {
62-
// Grow the root mapping
63-
fileGT.growIfRequired(toLine);
64-
} else {
65-
// Grow the root mapping
66-
fileGT.growIfRequired(toLine);
67-
}
63+
// Grow the root mapping
64+
fileGT.growIfRequired(toLine);
6865

69-
// Insert the annotations
66+
// Insert the matchings
7067
if (!node.isAnnotation()) {
7168
// set the matching
7269
fileGT.setMatching(currentRange, counterpartRange);
7370
}
7471

75-
// Also consider the #endif in case of an annotation
76-
toLine = (node.isAnnotation() && !node.isRoot()) ? toLine+1 : toLine;
7772
for (int lineNumber = fromLine; lineNumber < toLine; lineNumber++) {
7873
LineAnnotation existingAnnotation = fileGT.get(lineNumber - 1);
7974
if (existingAnnotation != null && existingAnnotation.nodeType().equals("artifact")) {

0 commit comments

Comments
 (0)