C#: Fix CFG for assertion.

This commit is contained in:
Anders Schack-Mulligen
2025-10-28 12:40:59 +01:00
parent e61ddf59d7
commit 87d89fd00f

View File

@@ -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())