Skip to content

Commit 3856540

Browse files
committed
C#: Add small module with relevant printing predicates.
1 parent 86c021e commit 3856540

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

csharp/ql/lib/csharp.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import semmle.code.csharp.Using
2121
import semmle.code.csharp.Variable
2222
import semmle.code.csharp.XML
2323
import semmle.code.csharp.Preprocessor
24+
import semmle.code.csharp.Printing
2425
import semmle.code.csharp.exprs.Access
2526
import semmle.code.csharp.exprs.ArithmeticOperation
2627
import semmle.code.csharp.exprs.Assignment
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Provides predicates to pretty-print a C# qualified name.
3+
*/
4+
5+
/**
6+
* Returns the concatenation of `qualifier` and `name`, separated by a dot.
7+
*/
8+
bindingset[qualifier, name]
9+
string printQualifiedName(string qualifier, string name) {
10+
if qualifier = "" then result = name else result = qualifier + "." + name
11+
}
12+
13+
/**
14+
* Returns the concatenation of `qualifier`, `type` and `name`, separated by a dot.
15+
*/
16+
bindingset[qualifier, type, name]
17+
string printQualifiedName(string qualifier, string type, string name) {
18+
result = printQualifiedName(qualifier, type) + "." + name
19+
}

0 commit comments

Comments
 (0)