mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +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)
|
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`. */
|
/** Gets a valid completion when argument `i` fails in assertion `a`. */
|
||||||
Completion assertionCompletion(Assertion a, int i) {
|
Completion assertionCompletion(Assertion a, int i) {
|
||||||
exists(AssertMethod am | am = a.getAssertMethod() |
|
exists(AssertMethod am | am = a.getAssertMethod() |
|
||||||
@@ -429,11 +424,6 @@ private predicate inBooleanContext(Expr e) {
|
|||||||
or
|
or
|
||||||
e = any(SpecificCatchClause scc).getFilterClause()
|
e = any(SpecificCatchClause scc).getFilterClause()
|
||||||
or
|
or
|
||||||
exists(BooleanAssertMethod m, int i |
|
|
||||||
assertion(_, i, m, e) and
|
|
||||||
i = m.getAnAssertionIndex(_)
|
|
||||||
)
|
|
||||||
or
|
|
||||||
e = any(LogicalNotExpr lne | inBooleanContext(lne)).getAnOperand()
|
e = any(LogicalNotExpr lne | inBooleanContext(lne)).getAnOperand()
|
||||||
or
|
or
|
||||||
exists(LogicalAndExpr lae |
|
exists(LogicalAndExpr lae |
|
||||||
@@ -481,11 +471,6 @@ private predicate inNullnessContext(Expr e) {
|
|||||||
or
|
or
|
||||||
exists(QualifiableExpr qe | qe.isConditional() | e = qe.getChildExpr(-1))
|
exists(QualifiableExpr qe | qe.isConditional() | e = qe.getChildExpr(-1))
|
||||||
or
|
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()))
|
exists(ConditionalExpr ce | inNullnessContext(ce) | (e = ce.getThen() or e = ce.getElse()))
|
||||||
or
|
or
|
||||||
exists(NullCoalescingExpr nce | inNullnessContext(nce) | e = nce.getRightOperand())
|
exists(NullCoalescingExpr nce | inNullnessContext(nce) | e = nce.getRightOperand())
|
||||||
|
|||||||
Reference in New Issue
Block a user