@@ -405,7 +405,7 @@ private module ControlFlowGraphImpl {
405
405
* Expressions and statements with CFG edges in post-order AST traversal.
406
406
*
407
407
* 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`).
409
409
* Only a few statements are included; those with specific side-effects
410
410
* occurring after the evaluation of their children, that is, `Call`, `ReturnStmt`,
411
411
* and `ThrowStmt`. CFG nodes without child nodes in the CFG that may complete
@@ -429,9 +429,10 @@ private module ControlFlowGraphImpl {
429
429
or
430
430
this instanceof CastExpr
431
431
or
432
- this instanceof InstanceOfExpr
432
+ this instanceof InstanceOfExpr and not this . ( InstanceOfExpr ) . isPattern ( )
433
433
or
434
- this instanceof LocalVariableDeclExpr
434
+ this instanceof LocalVariableDeclExpr and
435
+ not this = any ( InstanceOfExpr ioe ) .getLocalVariableDeclExpr ( )
435
436
or
436
437
this instanceof RValue
437
438
or
@@ -573,6 +574,8 @@ private module ControlFlowGraphImpl {
573
574
or
574
575
result = first ( n .( PostOrderNode ) .firstChild ( ) )
575
576
or
577
+ result = first ( n .( InstanceOfExpr ) .getExpr ( ) )
578
+ or
576
579
result = first ( n .( SynchronizedStmt ) .getExpr ( ) )
577
580
or
578
581
result = n and
@@ -707,6 +710,11 @@ private module ControlFlowGraphImpl {
707
710
last ( condexpr .getTrueExpr ( ) , last , completion )
708
711
)
709
712
or
713
+ exists ( InstanceOfExpr ioe | ioe .isPattern ( ) and ioe = n |
714
+ last = n and completion = basicBooleanCompletion ( false ) or
715
+ last = ioe .getLocalVariableDeclExpr ( ) and completion = basicBooleanCompletion ( true )
716
+ )
717
+ or
710
718
// The last node of a node executed in post-order is the node itself.
711
719
n .( PostOrderNode ) .mayCompleteNormally ( ) and last = n and completion = NormalCompletion ( )
712
720
or
@@ -916,6 +924,14 @@ private module ControlFlowGraphImpl {
916
924
result = first ( e .getFalseExpr ( ) )
917
925
)
918
926
or
927
+ exists ( InstanceOfExpr ioe | ioe .isPattern ( ) |
928
+ last ( ioe .getExpr ( ) , n , completion ) and completion = NormalCompletion ( ) and result = ioe
929
+ or
930
+ n = ioe and
931
+ result = ioe .getLocalVariableDeclExpr ( ) and
932
+ completion = basicBooleanCompletion ( true )
933
+ )
934
+ or
919
935
// In other expressions control flows from left to right and ends in the node itself.
920
936
exists ( PostOrderNode p , int i |
921
937
last ( p .getChildNode ( i ) , n , completion ) and completion = NormalCompletion ( )
0 commit comments