Expand the range of callables used in source to include potential virtual dispatch targets and referenced callables (e.g., in assigning a delegate)

This commit is contained in:
Chris Smowton
2024-09-16 16:36:51 +01:00
parent 66f48f767e
commit 349268cbf7

View File

@@ -1003,7 +1003,15 @@ private class CallableUsedInSource extends Callable {
CallableUsedInSource() {
this.fromSource()
or
this.getACall().fromSource()
// Note that getARuntimeTarget cannot be used here, because the
// DelegateLikeCall case depends on lambda-flow, which in turn
// uses the dataflow library; hence this would introduce recursion
// into the definition of data-flow nodes.
exists(Call c, DispatchCall dc | c.fromSource() and c = dc.getCall() |
this = dc.getADynamicTarget()
)
or
this = any(CallableAccess ca | ca.fromSource()).getTarget()
}
}