Skip to content

Commit c24302b

Browse files
committed
C#: Replace all uses of the deprecated hasQualifiedName/1 predicate.
1 parent 315a3a5 commit c24302b

File tree

140 files changed

+372
-313
lines changed

Some content is hidden

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

140 files changed

+372
-313
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().hasQualifiedName("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().hasQualifiedName("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+().hasQualifiedName("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().hasQualifiedName("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().hasQualifiedName("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+
.hasQualifiedName("System.Collections.Generic", "ICollection<>") 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().hasQualifiedName("System", "Object") and
1515
base.getAnOverrider() = override
1616
select override

csharp/ql/examples/snippets/throw_exception.ql

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

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

csharp/ql/lib/Linq/Helpers.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ private int numStmts(ForeachStmt fes) {
1919
}
2020

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

2424
/** Holds if the type's qualified name starts with "System.Collections.Generic.IEnumerable" */
2525
predicate isIEnumerableType(ValueOrRefType t) {

csharp/ql/lib/semmle/code/csharp/Stmt.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class BlockStmt extends Stmt, @block_stmt {
7575

7676
/** Holds if this block is the container of the global statements. */
7777
predicate isGlobalStatementContainer() {
78-
this.getEnclosingCallable().hasQualifiedName("Program.<Main>$")
78+
this.getEnclosingCallable().hasQualifiedName("Program", "<Main>$")
7979
}
8080

8181
override Stmt stripSingletonBlocks() {

0 commit comments

Comments
 (0)