@@ -14,7 +14,7 @@ predicate isOverlay() { databaseMetadata("isOverlay", "true") }
1414 * An abstract base class for all elements that can be discarded from the base.
1515 */
1616overlay [ local]
17- abstract private class DiscardableEntity extends @element {
17+ abstract private class DiscardableEntity extends @locatable {
1818 /** Gets the path to the file in which this element occurs. */
1919 abstract string getPath ( ) ;
2020
@@ -36,7 +36,7 @@ overlay[local]
3636private class StarEntity = @expr or @stmt;
3737
3838overlay [ discard_entity]
39- private predicate discardStarEntity ( @element e ) {
39+ private predicate discardStarEntity ( @locatable e ) {
4040 e instanceof StarEntity and
4141 // Entities with *-ids can exist either in base or overlay, but not both.
4242 exists ( DiscardableEntity de | de = e |
@@ -46,7 +46,7 @@ private predicate discardStarEntity(@element e) {
4646}
4747
4848overlay [ discard_entity]
49- private predicate discardNamedEntity ( @element e ) {
49+ private predicate discardNamedEntity ( @locatable e ) {
5050 not e instanceof StarEntity and
5151 // Entities with named IDs can exist both in base, overlay, or both.
5252 exists ( DiscardableEntity de | de = e |
@@ -73,155 +73,32 @@ private predicate discardLocation(@location_default loc) {
7373}
7474
7575overlay [ local]
76- private class ExprEntity extends DiscardableEntity instanceof @expr {
77- override string getPath ( ) {
78- exists ( @location_default loc | expr_location ( this , loc ) | result = getLocationPath ( loc ) )
79- }
80- }
81-
82- overlay [ local]
83- private class StmtEntity extends DiscardableEntity instanceof @stmt {
84- override string getPath ( ) {
85- exists ( @location_default loc | stmt_location ( this , loc ) | result = getLocationPath ( loc ) )
86- }
87- }
88-
89- overlay [ local]
90- private class UsingDirectiveEntity extends DiscardableEntity instanceof @using_directive {
91- override string getPath ( ) {
92- exists ( @location_default loc | using_directive_location ( this , loc ) |
93- result = getLocationPath ( loc )
94- )
95- }
96- }
97-
98- overlay [ local]
99- private class NamespaceDeclarationEntity extends DiscardableEntity instanceof @namespace_declaration
100- {
101- override string getPath ( ) {
102- exists ( @location_default loc | namespace_declaration_location ( this , loc ) |
103- result = getLocationPath ( loc )
104- )
105- }
106- }
107-
108- overlay [ local]
109- private class PreprocessorDirectiveEntity extends DiscardableEntity instanceof @preprocessor_directive
110- {
111- override string getPath ( ) {
112- exists ( @location_default loc | preprocessor_directive_location ( this , loc ) |
113- result = getLocationPath ( loc )
114- )
115- }
116- }
117-
118- overlay [ local]
119- private class TypeEntity extends DiscardableEntity instanceof @type {
120- override string getPath ( ) {
121- exists ( @location_default loc | type_location ( this , loc ) | result = getLocationPath ( loc ) )
122- }
123- }
124-
125- overlay [ local]
126- private class AttributeEntity extends DiscardableEntity instanceof @attribute {
127- override string getPath ( ) {
128- exists ( @location_default loc | attribute_location ( this , loc ) | result = getLocationPath ( loc ) )
129- }
130- }
131-
132- overlay [ local]
133- private class TypeParameterConstraintsEntity extends DiscardableEntity instanceof @type_parameter_constraints
134- {
135- override string getPath ( ) {
136- exists ( @location_default loc | type_parameter_constraints_location ( this , loc ) |
137- result = getLocationPath ( loc )
138- )
139- }
140- }
141-
142- overlay [ local]
143- private class PropertyEntity extends DiscardableEntity instanceof @property {
144- override string getPath ( ) {
145- exists ( @location_default loc | property_location ( this , loc ) | result = getLocationPath ( loc ) )
146- }
147- }
148-
149- overlay [ local]
150- private class IndexerEntity extends DiscardableEntity instanceof @indexer {
151- override string getPath ( ) {
152- exists ( @location_default loc | indexer_location ( this , loc ) | result = getLocationPath ( loc ) )
153- }
154- }
155-
156- overlay [ local]
157- private class AccessorEntity extends DiscardableEntity instanceof @accessor {
158- override string getPath ( ) {
159- exists ( @location_default loc | accessor_location ( this , loc ) | result = getLocationPath ( loc ) )
160- }
161- }
162-
163- overlay [ local]
164- private class EventEntity extends DiscardableEntity instanceof @event {
165- override string getPath ( ) {
166- exists ( @location_default loc | event_location ( this , loc ) | result = getLocationPath ( loc ) )
167- }
168- }
169-
170- overlay [ local]
171- private class EventAccessorEntity extends DiscardableEntity instanceof @event_accessor {
172- override string getPath ( ) {
173- exists ( @location_default loc | event_accessor_location ( this , loc ) |
174- result = getLocationPath ( loc )
76+ private class PossibleDiscardableEntity extends DiscardableEntity instanceof @locatable {
77+ override string getPath ( ) {
78+ exists ( @location_default loc | result = getLocationPath ( loc ) |
79+ expr_location ( this , loc ) or
80+ stmt_location ( this , loc ) or
81+ using_directive_location ( this , loc ) or
82+ namespace_declaration_location ( this , loc ) or
83+ preprocessor_directive_location ( this , loc ) or
84+ type_location ( this , loc ) or
85+ attribute_location ( this , loc ) or
86+ type_parameter_constraints_location ( this , loc ) or
87+ property_location ( this , loc ) or
88+ indexer_location ( this , loc ) or
89+ accessor_location ( this , loc ) or
90+ event_location ( this , loc ) or
91+ event_accessor_location ( this , loc ) or
92+ operator_location ( this , loc ) or
93+ method_location ( this , loc ) or
94+ constructor_location ( this , loc ) or
95+ destructor_location ( this , loc ) or
96+ field_location ( this , loc ) or
97+ localvar_location ( this , loc ) or
98+ param_location ( this , loc ) or
99+ type_mention_location ( this , loc ) or
100+ commentline_location ( this , loc ) or
101+ commentblock_location ( this , loc )
175102 )
176103 }
177104}
178-
179- overlay [ local]
180- private class OperatorEntity extends DiscardableEntity instanceof @operator {
181- override string getPath ( ) {
182- exists ( @location_default loc | operator_location ( this , loc ) | result = getLocationPath ( loc ) )
183- }
184- }
185-
186- overlay [ local]
187- private class MethodEntity extends DiscardableEntity instanceof @method {
188- override string getPath ( ) {
189- exists ( @location_default loc | method_location ( this , loc ) | result = getLocationPath ( loc ) )
190- }
191- }
192-
193- overlay [ local]
194- private class ConstructorEntity extends DiscardableEntity instanceof @constructor {
195- override string getPath ( ) {
196- exists ( @location_default loc | constructor_location ( this , loc ) | result = getLocationPath ( loc ) )
197- }
198- }
199-
200- overlay [ local]
201- private class DestructorEntity extends DiscardableEntity instanceof @destructor {
202- override string getPath ( ) {
203- exists ( @location_default loc | destructor_location ( this , loc ) | result = getLocationPath ( loc ) )
204- }
205- }
206-
207- overlay [ local]
208- private class FieldEntity extends DiscardableEntity instanceof @field {
209- override string getPath ( ) {
210- exists ( @location_default loc | field_location ( this , loc ) | result = getLocationPath ( loc ) )
211- }
212- }
213-
214- overlay [ local]
215- private class LocalVariableEntity extends DiscardableEntity instanceof @local_variable {
216- override string getPath ( ) {
217- exists ( @location_default loc | localvar_location ( this , loc ) | result = getLocationPath ( loc ) )
218- }
219- }
220-
221- overlay [ local]
222- private class ParameterEntity extends DiscardableEntity instanceof @parameter {
223- override string getPath ( ) {
224- exists ( @location_default loc | param_location ( this , loc ) | result = getLocationPath ( loc ) )
225- }
226- }
227- // TODO: We Still need to handle commentline, comment block entities and type mentions.
0 commit comments