@@ -59,9 +59,6 @@ static void analyzeNode(FileGT.Mutable fileGT, DiffNode<DiffLinesLabel> node, Ti
5959 int toLine = currentRange .toExclusive ();
6060
6161 if (node .isAnnotation ()) {
62- // Mark the start and end of this annotation block
63- fileGT .markBlockStart (fromLine );
64- fileGT .markBlockEnd (toLine );
6562 // Grow the root mapping
6663 fileGT .growIfRequired (toLine );
6764 } else {
@@ -75,15 +72,25 @@ static void analyzeNode(FileGT.Mutable fileGT, DiffNode<DiffLinesLabel> node, Ti
7572 fileGT .setMatching (currentRange , counterpartRange );
7673 }
7774
75+ // Also consider the #endif in case of an annotation
76+ toLine = (node .isAnnotation () && !node .isRoot ()) ? toLine +1 : toLine ;
7877 for (int lineNumber = fromLine ; lineNumber < toLine ; lineNumber ++) {
7978 LineAnnotation existingAnnotation = fileGT .get (lineNumber - 1 );
8079 if (existingAnnotation != null && existingAnnotation .nodeType ().equals ("artifact" )) {
8180 // Never overwrite artifact pcs with annotation pcs
8281 continue ;
8382 }
84- LineAnnotation annotation = new LineAnnotation (lineNumber ,
85- new FeatureMapping (featureMapping .toString ()), new PresenceCondition (presenceCondition .toString ()),
86- node .getNodeType ().name , presenceCondition .getUniqueContainedFeatures ());
83+ LineAnnotation annotation ;
84+ if (node .isAnnotation () && ignorePCChanges ) {
85+ // We set the PC and Mapping of all macro lines to '0', i.e., 'false
86+ annotation = new LineAnnotation (lineNumber ,
87+ new FeatureMapping ("0" ), new PresenceCondition ("0" ),
88+ node .getNodeType ().name , presenceCondition .getUniqueContainedFeatures ());
89+ } else {
90+ annotation = new LineAnnotation (lineNumber ,
91+ new FeatureMapping (featureMapping .toString ()), new PresenceCondition (presenceCondition .toString ()),
92+ node .getNodeType ().name , presenceCondition .getUniqueContainedFeatures ());
93+ }
8794 fileGT .insert (annotation );
8895 }
8996 }
0 commit comments