@@ -2,18 +2,20 @@ private import go
2
2
private import DataFlowPrivate
3
3
4
4
/**
5
- * Holds if `call` is an interface call to method `m`, meaning that its receiver `recv` has an
6
- * interface type.
5
+ * Holds if `call` is an interface call to method `m`, meaning that its receiver `recv` has
6
+ * interface type `tp` .
7
7
*/
8
- private predicate isInterfaceCallReceiver ( DataFlow:: CallNode call , DataFlow:: Node recv , string m ) {
8
+ private predicate isInterfaceCallReceiver (
9
+ DataFlow:: CallNode call , DataFlow:: Node recv , InterfaceType tp , string m
10
+ ) {
9
11
call .getReceiver ( ) = recv and
10
- recv .getType ( ) .getUnderlyingType ( ) instanceof InterfaceType and
12
+ recv .getType ( ) .getUnderlyingType ( ) = tp and
11
13
m = call .getCalleeName ( )
12
14
}
13
15
14
16
/** Gets a data-flow node that may flow into the receiver value of `call`, which is an interface value. */
15
17
private DataFlow:: Node getInterfaceCallReceiverSource ( DataFlow:: CallNode call ) {
16
- isInterfaceCallReceiver ( call , result .getASuccessor * ( ) , _)
18
+ isInterfaceCallReceiver ( call , result .getASuccessor * ( ) , _, _ )
17
19
}
18
20
19
21
/** Gets the type of `nd`, which must be a valid type and not an interface type. */
@@ -44,7 +46,7 @@ private predicate isConcreteValue(DataFlow::Node nd) {
44
46
* types of `recv` can be established by local reasoning.
45
47
*/
46
48
private predicate isConcreteInterfaceCall ( DataFlow:: Node call , DataFlow:: Node recv , string m ) {
47
- isInterfaceCallReceiver ( call , recv , m ) and isConcreteValue ( recv )
49
+ isInterfaceCallReceiver ( call , recv , _ , m ) and isConcreteValue ( recv )
48
50
}
49
51
50
52
/**
0 commit comments