mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
C#: Fix CFG for assertion.
This commit is contained in:
@@ -390,11 +390,6 @@ private predicate invalidCastCandidate(CastExpr ce) {
|
||||
ce.getExpr().getType() = getACastExprBaseType(ce)
|
||||
}
|
||||
|
||||
private predicate assertion(Assertion a, int i, AssertMethod am, Expr e) {
|
||||
e = a.getExpr(i) and
|
||||
am = a.getAssertMethod()
|
||||
}
|
||||
|
||||
/** Gets a valid completion when argument `i` fails in assertion `a`. */
|
||||
Completion assertionCompletion(Assertion a, int i) {
|
||||
exists(AssertMethod am | am = a.getAssertMethod() |
|
||||
@@ -429,11 +424,6 @@ private predicate inBooleanContext(Expr e) {
|
||||
or
|
||||
e = any(SpecificCatchClause scc).getFilterClause()
|
||||
or
|
||||
exists(BooleanAssertMethod m, int i |
|
||||
assertion(_, i, m, e) and
|
||||
i = m.getAnAssertionIndex(_)
|
||||
)
|
||||
or
|
||||
e = any(LogicalNotExpr lne | inBooleanContext(lne)).getAnOperand()
|
||||
or
|
||||
exists(LogicalAndExpr lae |
|
||||
@@ -481,11 +471,6 @@ private predicate inNullnessContext(Expr e) {
|
||||
or
|
||||
exists(QualifiableExpr qe | qe.isConditional() | e = qe.getChildExpr(-1))
|
||||
or
|
||||
exists(NullnessAssertMethod m, int i |
|
||||
assertion(_, i, m, e) and
|
||||
i = m.getAnAssertionIndex(_)
|
||||
)
|
||||
or
|
||||
exists(ConditionalExpr ce | inNullnessContext(ce) | (e = ce.getThen() or e = ce.getElse()))
|
||||
or
|
||||
exists(NullCoalescingExpr nce | inNullnessContext(nce) | e = nce.getRightOperand())
|
||||
|
||||
Reference in New Issue
Block a user