Skip to content

Commit 7787900

Browse files
committed
Python: make compile and simplify
1 parent 825f24a commit 7787900

File tree

1 file changed

+8
-30
lines changed

1 file changed

+8
-30
lines changed

python/ql/src/experimental/dataflow/internal/DataFlowPrivate.qll

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -280,48 +280,26 @@ predicate isUnreachableInCall(Node n, DataFlowCall call) {
280280
}
281281

282282
//--------
283-
// Fancy dispatch
283+
// Virtual dispatch with call context
284284
//--------
285285

286286
/**
287-
* Holds if the call context `ctx` reduces the set of viable run-time
288-
* targets of call `call` in `c`.
287+
* Gets a viable dispatch target of `call` in the context `ctx`. This is
288+
* restricted to those `call`s for which a context might make a difference.
289289
*/
290-
predicate reducedViableImplInCallContext(DataFlowCall call, DataFlowCallable c, DataFlowCall ctx) {
290+
DataFlowCallable viableImplInCallContext(DataFlowCall call, DataFlowCall ctx) {
291291
none()
292292
}
293293

294294
/**
295-
* Holds if flow returning from callable `c` to call `call` might return
296-
* further and if this path restricts the set of call sites that can be
297-
* returned to.
295+
* Holds if the set of viable implementations that can be called by `call`
296+
* might be improved by knowing the call context. This is the case if the qualifier accesses a parameter of
297+
* the enclosing callable `c` (including the implicit `this` parameter).
298298
*/
299-
predicate reducedViableImplInReturn(DataFlowCallable c, DataFlowCall call) {
299+
predicate mayBenefitFromCallContext(DataFlowCall call, DataFlowCallable c) {
300300
none()
301301
}
302302

303-
/**
304-
* Gets a viable run-time target for the call `call` in the context `ctx`.
305-
* This is restricted to those call nodes and results for which the return
306-
* flow from the result to `call` restricts the possible context `ctx`.
307-
*/
308-
DataFlowCallable prunedViableImplInCallContextReverse(DataFlowCall call, DataFlowCall ctx) {
309-
none()
310-
// result = viableImplInCallContext(call, ctx) and
311-
// reducedViableImplInReturn(result, call)
312-
}
313-
314-
/**
315-
* Gets a viable run-time target for the call `call` in the context
316-
* `ctx`. This is restricted to those call nodes for which a context
317-
* might make a difference.
318-
*/
319-
DataFlowCallable prunedViableImplInCallContext(DataFlowCall call, DataFlowCall ctx) {
320-
none()
321-
// result = viableImplInCallContext(call, ctx) and
322-
// reducedViableImplInCallContext(call, _, ctx)
323-
}
324-
325303
//--------
326304
// Misc
327305
//--------

0 commit comments

Comments
 (0)