Skip to content

Commit be6f771

Browse files
committed
C#: Use any instead of exists.
1 parent a549f49 commit be6f771

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

csharp/ql/src/Bad Practices/VirtualCallInConstructorOrDestructor.ql

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,15 @@ predicate overriddenSealed(RefType t, Virtualizable d) {
3434
}
3535

3636
predicate virtualAccessWithThisQualifier(Expr e, Member d) {
37-
exists(VirtualMethodCall c |
38-
c = e and c.getTarget() = d and c.hasThisQualifier() and not c.isImplicit()
39-
)
37+
e = any(VirtualMethodCall c | c.getTarget() = d and c.hasThisQualifier() and not c.isImplicit())
4038
or
41-
exists(VirtualMethodAccess c | c = e and c.getTarget() = d and c.hasThisQualifier())
39+
e = any(VirtualMethodAccess c | c.getTarget() = d and c.hasThisQualifier())
4240
or
43-
exists(VirtualPropertyAccess c | c = e and c.getTarget() = d and c.hasThisQualifier())
41+
e = any(VirtualPropertyAccess c | c.getTarget() = d and c.hasThisQualifier())
4442
or
45-
exists(VirtualIndexerAccess c | c = e and c.getTarget() = d and c.hasThisQualifier())
43+
e = any(VirtualIndexerAccess c | c.getTarget() = d and c.hasThisQualifier())
4644
or
47-
exists(VirtualEventAccess c | c = e and c.getTarget() = d and c.hasThisQualifier())
45+
e = any(VirtualEventAccess c | c.getTarget() = d and c.hasThisQualifier())
4846
}
4947

5048
from Expr e

0 commit comments

Comments
 (0)