@@ -88,7 +88,45 @@ private string baseConfigLocatable(@configLocatable el) {
8888 not isOverlay ( ) and result = getRawFileForConfig ( el )
8989}
9090
91+ overlay [ local]
92+ private predicate overlayConfigExtracted ( string file ) {
93+ isOverlay ( ) and
94+ exists ( @configLocatable el | file = getRawFileForConfig ( el ) )
95+ }
96+
9197overlay [ discard_entity]
9298private predicate discardBaseConfigLocatable ( @configLocatable el ) {
9399 overlayChangedFiles ( baseConfigLocatable ( el ) )
100+ or
101+ // The config extractor is currently not incremental and may extract more
102+ // property files than those included in overlayChangedFiles.
103+ overlayConfigExtracted ( baseConfigLocatable ( el ) )
104+ }
105+
106+ /**
107+ * An `@xmllocatable` that should be discarded in the base variant if its file is
108+ * extracted in the overlay variant.
109+ */
110+ overlay [ local]
111+ abstract class DiscardableXmlLocatable extends @xmllocatable {
112+ /** Gets the raw file for an xmllocatable in base. */
113+ string getRawFileInBase ( ) { not isOverlay ( ) and result = getRawFile ( this ) }
114+
115+ /** Gets a textual representation of this discardable xmllocatable. */
116+ string toString ( ) { none ( ) }
117+ }
118+
119+ overlay [ local]
120+ private predicate overlayXmlExtracted ( string file ) {
121+ isOverlay ( ) and
122+ exists ( @xmllocatable el | not files ( el , _) and not xmlNs ( el , _, _, _) and file = getRawFile ( el ) )
123+ }
124+
125+ overlay [ discard_entity]
126+ private predicate discardXmlLocatable ( @xmllocatable el ) {
127+ overlayChangedFiles ( el .( DiscardableXmlLocatable ) .getRawFileInBase ( ) )
128+ or
129+ // The XML extractor is currently not incremental and may extract more
130+ // XML files than those included in overlayChangedFiles.
131+ overlayXmlExtracted ( el .( DiscardableXmlLocatable ) .getRawFileInBase ( ) )
94132}
0 commit comments