Skip to content

Commit 0cb27e7

Browse files
committed
C#: Add toString functionality consistency queries
1 parent b615e98 commit 0cb27e7

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

csharp/ql/consistency-queries/AstConsistency.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ query predicate missingLocation(Element e) {
1717
not exists(TupleType t | e = t or e = t.getAField()) and
1818
not exists(e.getLocation())
1919
}
20+
21+
query predicate multipleToString(Element e, string s) {
22+
s = strictconcat(e.toString(), ",") and
23+
strictcount(e.toString()) > 1
24+
}

csharp/ql/consistency-queries/CfgConsistency.ql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,8 @@ query predicate preBasicBlockConsistency(ControlFlowElement cfe1, ControlFlowEle
6262
bbIntraSuccInconsistency(cfe1, cfe2) and
6363
s = "intra succ inconsistency"
6464
}
65+
66+
query predicate multipleToString(Node n, string s) {
67+
s = strictconcat(n.toString(), ",") and
68+
strictcount(n.toString()) > 1
69+
}

csharp/ql/consistency-queries/DataFlowConsistency.ql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,8 @@ private class MyConsistencyConfiguration extends ConsistencyConfiguration {
7474

7575
override predicate identityLocalStepExclude(Node n) { none() }
7676
}
77+
78+
query predicate multipleToString(Node n, string s) {
79+
s = strictconcat(n.toString(), ",") and
80+
strictcount(n.toString()) > 1
81+
}

0 commit comments

Comments
 (0)