Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aa78a43

Browse files
committed
Python: Enable type-tracking in call-graph test
1 parent c85ccb2 commit aa78a43

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

python/ql/test/experimental/library-tests/CallGraph/InlineCallGraphTest.ql

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import python
22
import TestUtilities.InlineExpectationsTest
3+
private import semmle.python.dataflow.new.internal.DataFlowDispatch as TT
34

45
/** Holds when `call` is resolved to `callable` using points-to based call-graph. */
56
predicate pointsToCallEdge(CallNode call, Function callable) {
@@ -10,7 +11,13 @@ predicate pointsToCallEdge(CallNode call, Function callable) {
1011
}
1112

1213
/** Holds when `call` is resolved to `callable` using type-tracking based call-graph. */
13-
predicate typeTrackerCallEdge(CallNode call, Function callable) { none() }
14+
predicate typeTrackerCallEdge(CallNode call, Function callable) {
15+
exists(TT::DataFlowCallable dfCallable, TT::DataFlowCall dfCall |
16+
dfCallable.getScope() = callable and
17+
dfCall.getNode() = call and
18+
dfCallable = TT::viableCallable(dfCall)
19+
)
20+
}
1421

1522
class CallGraphTest extends InlineExpectationsTest {
1623
CallGraphTest() { this = "CallGraphTest" }

0 commit comments

Comments
 (0)