@@ -293,7 +293,7 @@ private module ControlFlowGraphImpl {
293293 exists ( ConditionalExpr condexpr |
294294 condexpr .getCondition ( ) = b
295295 or
296- ( condexpr .getTrueExpr ( ) = b or condexpr . getFalseExpr ( ) = b ) and
296+ condexpr .getABranchExpr ( ) = b and
297297 inBooleanContext ( condexpr )
298298 )
299299 or
@@ -706,8 +706,7 @@ private module ControlFlowGraphImpl {
706706 or
707707 // The last node of a `ConditionalExpr` is in either of its branches.
708708 exists ( ConditionalExpr condexpr | condexpr = n |
709- last ( condexpr .getFalseExpr ( ) , last , completion ) or
710- last ( condexpr .getTrueExpr ( ) , last , completion )
709+ last ( condexpr .getABranchExpr ( ) , last , completion )
711710 )
712711 or
713712 exists ( InstanceOfExpr ioe | ioe .isPattern ( ) and ioe = n |
@@ -915,14 +914,10 @@ private module ControlFlowGraphImpl {
915914 )
916915 or
917916 // Control flows to the corresponding branch depending on the boolean completion of the condition.
918- exists ( ConditionalExpr e |
917+ exists ( ConditionalExpr e , boolean branch |
919918 last ( e .getCondition ( ) , n , completion ) and
920- completion = BooleanCompletion ( true , _) and
921- result = first ( e .getTrueExpr ( ) )
922- or
923- last ( e .getCondition ( ) , n , completion ) and
924- completion = BooleanCompletion ( false , _) and
925- result = first ( e .getFalseExpr ( ) )
919+ completion = BooleanCompletion ( branch , _) and
920+ result = first ( e .getBranchExpr ( branch ) )
926921 )
927922 or
928923 exists ( InstanceOfExpr ioe | ioe .isPattern ( ) |
0 commit comments