@@ -154,6 +154,23 @@ class Type extends @type {
154
154
* Gets a basic textual representation of this type.
155
155
*/
156
156
string toString ( ) { result = this .getName ( ) }
157
+
158
+ /**
159
+ * Holds if this element is at the specified location.
160
+ * The location spans column `startcolumn` of line `startline` to
161
+ * column `endcolumn` of line `endline` in file `filepath`.
162
+ * For more information, see
163
+ * [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
164
+ */
165
+ predicate hasLocationInfo (
166
+ string filepath , int startline , int startcolumn , int endline , int endcolumn
167
+ ) {
168
+ filepath = "" and
169
+ startline = 0 and
170
+ startcolumn = 0 and
171
+ endline = 0 and
172
+ endcolumn = 0
173
+ }
157
174
}
158
175
159
176
/** An invalid type. */
@@ -997,6 +1014,17 @@ class NamedType extends @namedtype, CompositeType {
997
1014
}
998
1015
999
1016
override Type getUnderlyingType ( ) { result = this .getBaseType ( ) .getUnderlyingType ( ) }
1017
+
1018
+ override predicate hasLocationInfo (
1019
+ string filepath , int startline , int startcolumn , int endline , int endcolumn
1020
+ ) {
1021
+ exists ( DeclaredType dt |
1022
+ dt .getType ( ) = this and
1023
+ // Note that if the type declaration isn't in the source that we have
1024
+ // then we use a dummy location.
1025
+ dt .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
1026
+ )
1027
+ }
1000
1028
}
1001
1029
1002
1030
/**
0 commit comments