@@ -286,7 +286,7 @@ private module ControlFlowGraphImpl {
286286 * That is, contexts where the control-flow edges depend on `value` given that `b` ends
287287 * with a `booleanCompletion(value, _)`.
288288 */
289- private predicate inBooleanContext ( Expr b ) {
289+ private predicate inBooleanContext ( ControlFlowNode b ) {
290290 exists ( LogicExpr logexpr |
291291 logexpr .( BinaryExpr ) .getLeftOperand ( ) = b
292292 or
@@ -316,6 +316,10 @@ private module ControlFlowGraphImpl {
316316 inBooleanContext ( whenexpr ) and
317317 whenexpr .getBranch ( _) .getAResult ( ) = b
318318 )
319+ or
320+ inBooleanContext ( b .( ExprStmt ) .getExpr ( ) )
321+ or
322+ inBooleanContext ( b .( StmtExpr ) .getStmt ( ) )
319323 }
320324
321325 /**
@@ -907,7 +911,8 @@ private module ControlFlowGraphImpl {
907911 )
908912 or
909913 // the last node in an `ExprStmt` is the last node in the expression
910- last ( n .( ExprStmt ) .getExpr ( ) , last , completion ) and completion = NormalCompletion ( )
914+ last ( n .( ExprStmt ) .getExpr ( ) , last , completion ) and
915+ completion instanceof NormalOrBooleanCompletion
911916 or
912917 // the last node in a `StmtExpr` is the last node in the statement
913918 last ( n .( StmtExpr ) .getStmt ( ) , last , completion )
0 commit comments