@@ -405,7 +405,7 @@ private module ControlFlowGraphImpl {
405405 * Expressions and statements with CFG edges in post-order AST traversal.
406406 *
407407 * This includes most expressions, except those that initiate or propagate branching control
408- * flow (`LogicExpr`, `ConditionalExpr`), and parentheses, which aren't in the CFG .
408+ * flow (`LogicExpr`, `ConditionalExpr`).
409409 * Only a few statements are included; those with specific side-effects
410410 * occurring after the evaluation of their children, that is, `Call`, `ReturnStmt`,
411411 * and `ThrowStmt`. CFG nodes without child nodes in the CFG that may complete
@@ -429,9 +429,10 @@ private module ControlFlowGraphImpl {
429429 or
430430 this instanceof CastExpr
431431 or
432- this instanceof InstanceOfExpr
432+ this instanceof InstanceOfExpr and not this . ( InstanceOfExpr ) . isPattern ( )
433433 or
434- this instanceof LocalVariableDeclExpr
434+ this instanceof LocalVariableDeclExpr and
435+ not this = any ( InstanceOfExpr ioe ) .getLocalVariableDeclExpr ( )
435436 or
436437 this instanceof RValue
437438 or
@@ -573,6 +574,8 @@ private module ControlFlowGraphImpl {
573574 or
574575 result = first ( n .( PostOrderNode ) .firstChild ( ) )
575576 or
577+ result = first ( n .( InstanceOfExpr ) .getExpr ( ) )
578+ or
576579 result = first ( n .( SynchronizedStmt ) .getExpr ( ) )
577580 or
578581 result = n and
@@ -707,6 +710,12 @@ private module ControlFlowGraphImpl {
707710 last ( condexpr .getTrueExpr ( ) , last , completion )
708711 )
709712 or
713+ exists ( InstanceOfExpr ioe | ioe .isPattern ( ) and ioe = n |
714+ last = n and completion = basicBooleanCompletion ( false )
715+ or
716+ last = ioe .getLocalVariableDeclExpr ( ) and completion = basicBooleanCompletion ( true )
717+ )
718+ or
710719 // The last node of a node executed in post-order is the node itself.
711720 n .( PostOrderNode ) .mayCompleteNormally ( ) and last = n and completion = NormalCompletion ( )
712721 or
@@ -916,6 +925,14 @@ private module ControlFlowGraphImpl {
916925 result = first ( e .getFalseExpr ( ) )
917926 )
918927 or
928+ exists ( InstanceOfExpr ioe | ioe .isPattern ( ) |
929+ last ( ioe .getExpr ( ) , n , completion ) and completion = NormalCompletion ( ) and result = ioe
930+ or
931+ n = ioe and
932+ result = ioe .getLocalVariableDeclExpr ( ) and
933+ completion = basicBooleanCompletion ( true )
934+ )
935+ or
919936 // In other expressions control flows from left to right and ends in the node itself.
920937 exists ( PostOrderNode p , int i |
921938 last ( p .getChildNode ( i ) , n , completion ) and completion = NormalCompletion ( )
0 commit comments