@@ -207,14 +207,12 @@ class UnreachableBasicBlock extends BasicBlock {
207207 conditionBlock .controls ( this , constant .booleanNot ( ) )
208208 )
209209 or
210- // This block is not reachable in the CFG, and is not a callable, a body of a callable, an
211- // expression in an annotation, an expression in an assert statement, or a catch clause.
210+ // This block is not reachable in the CFG, and is not the entrypoint in a callable, an
211+ // expression in an assert statement, or a catch clause.
212212 forall ( BasicBlock bb | bb = this .getABBPredecessor ( ) | bb instanceof UnreachableBasicBlock ) and
213- not exists ( Callable c | c .getBody ( ) = this ) and
214- not this instanceof Callable and
215- not exists ( Annotation a | a .getAChildExpr * ( ) = this ) and
216- not this .( Expr ) .getEnclosingStmt ( ) instanceof AssertStmt and
217- not this instanceof CatchClause
213+ not exists ( Callable c | c .getBody ( ) .getControlFlowNode ( ) = this .getFirstNode ( ) ) and
214+ not exists ( AssertStmt a | a = this .getFirstNode ( ) .asExpr ( ) .getEnclosingStmt ( ) ) and
215+ not this .getFirstNode ( ) .asStmt ( ) instanceof CatchClause
218216 or
219217 // Switch statements with a constant comparison expression may have unreachable cases.
220218 exists ( ConstSwitchStmt constSwitchStmt , BasicBlock failingCaseBlock |
@@ -223,7 +221,7 @@ class UnreachableBasicBlock extends BasicBlock {
223221 // Not accessible from the successful case
224222 not constSwitchStmt .getMatchingCase ( ) .getBasicBlock ( ) .getABBSuccessor * ( ) = failingCaseBlock and
225223 // Blocks dominated by the failing case block are unreachable
226- constSwitchStmt . getAFailingCase ( ) . getBasicBlock ( ) .bbDominates ( this )
224+ failingCaseBlock .bbDominates ( this )
227225 )
228226 }
229227}
0 commit comments