Skip to content

Commit 68055bc

Browse files
michaelnebelhvitved
authored andcommitted
C#: Update flow summaries test code.
1 parent c8a7354 commit 68055bc

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import shared.FlowSummaries
2+
private import semmle.code.csharp.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
23

34
private class IncludeAllSummarizedCallable extends IncludeSummarizedCallable {
4-
IncludeAllSummarizedCallable() { this instanceof SummarizedCallable }
5+
IncludeAllSummarizedCallable() { this instanceof FlowSummaryImpl::Public::SummarizedCallable }
56
}

csharp/ql/test/library-tests/dataflow/library/FlowSummariesFiltered.ql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import shared.FlowSummaries
2+
private import semmle.code.csharp.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
23
private import semmle.code.csharp.dataflow.internal.DataFlowPrivate::Csv
34
private import semmle.code.csharp.dataflow.ExternalFlow
45

56
class IncludeFilteredSummarizedCallable extends IncludeSummarizedCallable {
6-
IncludeFilteredSummarizedCallable() { this instanceof SummarizedCallable }
7+
IncludeFilteredSummarizedCallable() {
8+
this instanceof FlowSummaryImpl::Public::SummarizedCallable
9+
}
710

811
/**
912
* Holds if flow is propagated between `input` and `output` and
@@ -15,9 +18,9 @@ class IncludeFilteredSummarizedCallable extends IncludeSummarizedCallable {
1518
) {
1619
this.propagatesFlow(input, output, preservesValue) and
1720
not exists(IncludeSummarizedCallable rsc |
18-
isBaseCallableOrPrototype(rsc) and
21+
isBaseCallableOrPrototype(rsc.asCallable()) and
1922
rsc.propagatesFlow(input, output, preservesValue) and
20-
this.(UnboundCallable).overridesOrImplementsUnbound(rsc)
23+
this.asCallable().(UnboundCallable).overridesOrImplementsUnbound(rsc.asCallable())
2124
)
2225
}
2326
}

csharp/ql/test/shared/FlowSummaries.qll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ private import semmle.code.csharp.dataflow.internal.DataFlowPrivate
44

55
abstract class IncludeSummarizedCallable extends RelevantSummarizedCallable {
66
IncludeSummarizedCallable() {
7-
[this.(Modifiable), this.(Accessor).getDeclaration()].isEffectivelyPublic()
7+
[this.asCallable().(Modifiable), this.asCallable().(Accessor).getDeclaration()]
8+
.isEffectivelyPublic()
89
}
910

1011
/** Gets a string representing the callable in semi-colon separated format for use in flow summaries. */
11-
final override string getCallableCsv() { result = Csv::asPartialModel(this) }
12+
final override string getCallableCsv() { result = Csv::asPartialModel(this.asCallable()) }
1213
}

0 commit comments

Comments
 (0)