Skip to content

Commit b72f345

Browse files
committed
C#: Use {get,has}FullyQualifiedName throughout
1 parent 66dc550 commit b72f345

File tree

242 files changed

+565
-517
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

242 files changed

+565
-517
lines changed

csharp/ql/examples/snippets/catch_exception.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
import csharp
1111

1212
from CatchClause catch
13-
where catch.getCaughtExceptionType().hasQualifiedName("System.IO", "IOException")
13+
where catch.getCaughtExceptionType().hasFullyQualifiedName("System.IO", "IOException")
1414
select catch

csharp/ql/examples/snippets/constructor_call.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
import csharp
1111

1212
from ObjectCreation new
13-
where new.getObjectType().hasQualifiedName("System", "Exception")
13+
where new.getObjectType().hasFullyQualifiedName("System", "Exception")
1414
select new

csharp/ql/examples/snippets/extend_class.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
import csharp
1414

1515
from RefType type
16-
where type.getABaseType+().hasQualifiedName("System.Collections", "IEnumerator")
16+
where type.getABaseType+().hasFullyQualifiedName("System.Collections", "IEnumerator")
1717
select type

csharp/ql/examples/snippets/field_read.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ import csharp
1111
from Field f, FieldRead read
1212
where
1313
f.hasName("VirtualAddress") and
14-
f.getDeclaringType().hasQualifiedName("Mono.Cecil.PE", "Section") and
14+
f.getDeclaringType().hasFullyQualifiedName("Mono.Cecil.PE", "Section") and
1515
f = read.getTarget()
1616
select read

csharp/ql/examples/snippets/method_call.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ from MethodCall call, Method method
1212
where
1313
call.getTarget() = method and
1414
method.hasName("MethodName") and
15-
method.getDeclaringType().hasQualifiedName("Company", "Class")
15+
method.getDeclaringType().hasFullyQualifiedName("Company", "Class")
1616
select call

csharp/ql/examples/snippets/null_argument.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ where
1717
add.hasName("Add") and
1818
add.getDeclaringType()
1919
.getUnboundDeclaration()
20-
.hasQualifiedName("System.Collections.Generic", "ICollection<>") and
20+
.hasFullyQualifiedName("System.Collections.Generic", "ICollection`1") and
2121
call.getAnArgument() instanceof NullLiteral
2222
select call

csharp/ql/examples/snippets/override_method.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ import csharp
1111
from Method override, Method base
1212
where
1313
base.hasName("ToString") and
14-
base.getDeclaringType().hasQualifiedName("System", "Object") and
14+
base.getDeclaringType().hasFullyQualifiedName("System", "Object") and
1515
base.getAnOverrider() = override
1616
select override

csharp/ql/examples/snippets/throw_exception.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
import csharp
1010

1111
from ThrowStmt throw
12-
where throw.getThrownExceptionType().getBaseClass*().hasQualifiedName("System.IO", "IOException")
12+
where
13+
throw.getThrownExceptionType().getBaseClass*().hasFullyQualifiedName("System.IO", "IOException")
1314
select throw

csharp/ql/integration-tests/all-platforms/diag_recursive_generics/Types.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import csharp
22

33
from Class c
44
where c.fromSource()
5-
select c, c.getBaseClass().getQualifiedName()
5+
select c, c.getBaseClass().getFullyQualifiedName()

csharp/ql/lib/Linq/Helpers.qll

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ private int numStmts(ForeachStmt fes) {
2121
}
2222

2323
/** Holds if the type's qualified name is "System.Linq.Enumerable" */
24-
predicate isEnumerableType(ValueOrRefType t) { t.hasQualifiedName("System.Linq", "Enumerable") }
24+
predicate isEnumerableType(ValueOrRefType t) {
25+
t.hasFullyQualifiedName("System.Linq", "Enumerable")
26+
}
2527

2628
/** Holds if the type's qualified name starts with "System.Collections.Generic.IEnumerable" */
2729
predicate isIEnumerableType(ValueOrRefType t) {
2830
exists(string type |
29-
t.hasQualifiedName("System.Collections.Generic", type) and
31+
t.hasFullyQualifiedName("System.Collections.Generic", type) and
3032
type.matches("IEnumerable%")
3133
)
3234
}
@@ -159,7 +161,7 @@ class AnyCall extends MethodCall {
159161
exists(Method m |
160162
m = this.getTarget().getUnboundDeclaration() and
161163
isEnumerableType(m.getDeclaringType()) and
162-
m.hasName("Any<>")
164+
m.hasName("Any`1")
163165
)
164166
}
165167
}
@@ -170,7 +172,7 @@ class CountCall extends MethodCall {
170172
exists(Method m |
171173
m = this.getTarget().getUnboundDeclaration() and
172174
isEnumerableType(m.getDeclaringType()) and
173-
m.hasName("Count<>")
175+
m.hasName("Count`1")
174176
)
175177
}
176178
}
@@ -186,7 +188,7 @@ class SelectCall extends ExtensionMethodCall {
186188
exists(Method m |
187189
m = this.getTarget().getUnboundDeclaration() and
188190
isEnumerableType(m.getDeclaringType()) and
189-
m.hasName("Select<,>")
191+
m.hasName("Select`2")
190192
)
191193
}
192194

0 commit comments

Comments
 (0)