Files
codeql/csharp/ql/test/library-tests/dataflow/delegates/DelegateFlow.ql
2020-10-14 14:15:34 +02:00

23 lines
737 B
Plaintext

import csharp
import semmle.code.csharp.dataflow.internal.DataFlowPrivate
import semmle.code.csharp.dataflow.internal.DelegateDataFlow
private class NodeAdjusted extends TNode {
string toString() { result = this.(DataFlow::Node).toString() }
Location getLocation() {
exists(Location l |
l = this.(DataFlow::Node).getLocation() and
if l instanceof SourceLocation then result = l else result instanceof EmptyLocation
)
}
}
query predicate summaryDelegateCall(NodeAdjusted sink, Callable c, CallContext::CallContext cc) {
c = sink.(SummaryDelegateParameterSink).getARuntimeTarget(cc)
}
query predicate delegateCall(DelegateCall dc, Callable c, CallContext::CallContext cc) {
c = dc.getARuntimeTarget(cc)
}