Skip to content

Commit c7b0ae8

Browse files
committed
C#: Re-factor the CollectionFlow test to use the new API.
1 parent 518aceb commit c7b0ae8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

csharp/ql/test/library-tests/dataflow/collections/CollectionFlow.ql

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
*/
44

55
import csharp
6-
import DataFlow::PathGraph
6+
import ArrayFlow::PathGraph
77

8-
class Conf extends DataFlow::Configuration {
9-
Conf() { this = "ArrayFlowConf" }
8+
module ArrayFlowConfig implements DataFlow::ConfigSig {
9+
predicate isSource(DataFlow::Node src) { src.asExpr() instanceof ObjectCreation }
1010

11-
override predicate isSource(DataFlow::Node src) { src.asExpr() instanceof ObjectCreation }
12-
13-
override predicate isSink(DataFlow::Node sink) {
11+
predicate isSink(DataFlow::Node sink) {
1412
exists(MethodCall mc |
1513
mc.getTarget().hasUndecoratedName("Sink") and
1614
mc.getAnArgument() = sink.asExpr()
1715
)
1816
}
1917

20-
override int fieldFlowBranchLimit() { result = 100 }
18+
int fieldFlowBranchLimit() { result = 100 }
2119
}
2220

23-
from DataFlow::PathNode source, DataFlow::PathNode sink, Conf conf
24-
where conf.hasFlowPath(source, sink)
21+
module ArrayFlow = DataFlow::Global<ArrayFlowConfig>;
22+
23+
from ArrayFlow::PathNode source, ArrayFlow::PathNode sink
24+
where ArrayFlow::flowPath(source, sink)
2525
select source, source, sink, "$@", sink, sink.toString()

0 commit comments

Comments
 (0)