mirror of
https://github.com/github/codeql.git
synced 2026-01-30 06:42:57 +01:00
Cleanup: use TypeSwitchStmt.getAssign, not a raw child accessor
This commit is contained in:
@@ -882,6 +882,9 @@ class TypeSwitchStmt extends @typeswitchstmt, SwitchStmt {
|
||||
/** Gets the assign statement of this type-switch statement. */
|
||||
SimpleAssignStmt getAssign() { result = getChildStmt(1) }
|
||||
|
||||
/** Gets the test statement of this type-switch statement. This is a `SimpleAssignStmt` or `ExprStmt`. */
|
||||
Stmt getTest() { result = getChildStmt(1) }
|
||||
|
||||
/** Gets the expression whose type is examined by this `switch` statement. */
|
||||
Expr getExpr() { result = getAssign().getRhs() or result = getChildStmt(1).(ExprStmt).getExpr() }
|
||||
|
||||
|
||||
@@ -1761,7 +1761,7 @@ module CFG {
|
||||
or
|
||||
first = MkImplicitTrue(this)
|
||||
or
|
||||
firstNode(this.(TypeSwitchStmt).getChildStmt(1), first)
|
||||
firstNode(this.(TypeSwitchStmt).getTest(), first)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1775,7 +1775,7 @@ module CFG {
|
||||
last = MkImplicitTrue(this) and
|
||||
cmpl = Bool(true)
|
||||
or
|
||||
lastNode(this.(TypeSwitchStmt).getChildStmt(1), last, cmpl)
|
||||
lastNode(this.(TypeSwitchStmt).getTest(), last, cmpl)
|
||||
) and
|
||||
(
|
||||
not cmpl.isNormal()
|
||||
@@ -1811,13 +1811,13 @@ module CFG {
|
||||
(
|
||||
firstNode(this.(ExpressionSwitchStmt).getExpr(), succ) or
|
||||
succ = MkImplicitTrue(this) or
|
||||
firstNode(this.(TypeSwitchStmt).getChildStmt(1), succ)
|
||||
firstNode(this.(TypeSwitchStmt).getTest(), succ)
|
||||
)
|
||||
or
|
||||
(
|
||||
lastNode(this.(ExpressionSwitchStmt).getExpr(), pred, normalCompletion()) or
|
||||
pred = MkImplicitTrue(this) or
|
||||
lastNode(this.(TypeSwitchStmt).getChildStmt(1), pred, normalCompletion())
|
||||
lastNode(this.(TypeSwitchStmt).getTest(), pred, normalCompletion())
|
||||
) and
|
||||
(
|
||||
firstNode(getNonDefaultCase(0), succ)
|
||||
|
||||
Reference in New Issue
Block a user