mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Nullness library: recognise switches with null checks
This commit is contained in:
@@ -1542,6 +1542,11 @@ class SwitchExpr extends Expr, StmtParent, @switchexpr {
|
||||
exists(YieldStmt yield | yield.getTarget() = this and result = yield.getValue())
|
||||
}
|
||||
|
||||
/** Holds if this switch has a case handling a null literal. */
|
||||
predicate hasNullCase() {
|
||||
this.getAConstCase().getValue(_) instanceof NullLiteral
|
||||
}
|
||||
|
||||
/** Gets a printable representation of this expression. */
|
||||
override string toString() { result = "switch (...)" }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user