@@ -311,6 +311,13 @@ class DataFlowCallable extends TDataFlowCallable {
311
311
.hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
312
312
}
313
313
314
+ /** Gets the location of this callable. */
315
+ Location getLocation ( ) {
316
+ result = getCallableLocation ( this .asCallable ( ) ) or
317
+ result = this .asFileScope ( ) .getLocation ( ) or
318
+ result = getCallableLocation ( this .asSummarizedCallable ( ) )
319
+ }
320
+
314
321
/** Gets a best-effort total ordering. */
315
322
int totalorder ( ) {
316
323
this =
@@ -322,6 +329,13 @@ class DataFlowCallable extends TDataFlowCallable {
322
329
}
323
330
}
324
331
332
+ private Location getCallableLocation ( Callable c ) {
333
+ exists ( string filepath , int startline , int startcolumn , int endline , int endcolumn |
334
+ c .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn ) and
335
+ result .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
336
+ )
337
+ }
338
+
325
339
/** A function call relevant for data flow. */
326
340
class DataFlowCall extends Expr {
327
341
DataFlow:: CallNode call ;
@@ -344,6 +358,9 @@ class DataFlowCall extends Expr {
344
358
not exists ( this .getEnclosingFunction ( ) ) and result .asFileScope ( ) = this .getFile ( )
345
359
}
346
360
361
+ /** Gets the location of this call. */
362
+ Location getLocation ( ) { result = super .getLocation ( ) }
363
+
347
364
/** Gets a best-effort total ordering. */
348
365
int totalorder ( ) {
349
366
this =
0 commit comments