@@ -39,9 +39,12 @@ Callable viableCallable(Call c) {
39
39
c instanceof ConstructorCall and result = c .getCallee ( ) .getSourceDeclaration ( )
40
40
}
41
41
42
- /** A method that is the target of a call. */
43
- class CalledMethod extends Method {
44
- CalledMethod ( ) { exists ( MethodAccess ma | ma .getMethod ( ) = this ) }
42
+ /** The source declaration of a method that is the target of a virtual call. */
43
+ class VirtCalledSrcMethod extends SrcMethod {
44
+ pragma [ nomagic]
45
+ VirtCalledSrcMethod ( ) {
46
+ exists ( VirtualMethodAccess ma | ma .getMethod ( ) .getSourceDeclaration ( ) = this )
47
+ }
45
48
}
46
49
47
50
cached
@@ -73,7 +76,7 @@ private module Dispatch {
73
76
(
74
77
exists ( Method def , RefType t , boolean exact |
75
78
qualType ( ma , t , exact ) and
76
- def = ma .getMethod ( )
79
+ def = ma .getMethod ( ) . getSourceDeclaration ( )
77
80
|
78
81
exact = true and result = exactMethodImpl ( def , t .getSourceDeclaration ( ) )
79
82
or
@@ -185,8 +188,8 @@ private module Dispatch {
185
188
not result .isAbstract ( ) and
186
189
if source instanceof VirtualMethodAccess
187
190
then
188
- exists ( CalledMethod def , RefType t , boolean exact |
189
- source .getMethod ( ) = def and
191
+ exists ( VirtCalledSrcMethod def , RefType t , boolean exact |
192
+ source .getMethod ( ) . getSourceDeclaration ( ) = def and
190
193
hasQualifierType ( source , t , exact )
191
194
|
192
195
exact = true and result = exactMethodImpl ( def , t .getSourceDeclaration ( ) )
@@ -301,14 +304,14 @@ private module Dispatch {
301
304
302
305
/** Gets the implementation of `top` present on a value of precisely type `t`. */
303
306
cached
304
- Method exactMethodImpl ( CalledMethod top , SrcRefType t ) {
307
+ Method exactMethodImpl ( VirtCalledSrcMethod top , SrcRefType t ) {
305
308
hasSrcMethod ( t , result ) and
306
- top .getAPossibleImplementation ( ) = result
309
+ top .getAPossibleImplementationOfSrcMethod ( ) = result
307
310
}
308
311
309
312
/** Gets the implementations of `top` present on viable subtypes of `t`. */
310
313
cached
311
- Method viableMethodImpl ( CalledMethod top , SrcRefType tsrc , RefType t ) {
314
+ Method viableMethodImpl ( VirtCalledSrcMethod top , SrcRefType tsrc , RefType t ) {
312
315
exists ( SrcRefType sub |
313
316
result = exactMethodImpl ( top , sub ) and
314
317
tsrc = t .getSourceDeclaration ( ) and
0 commit comments