Fix CFG construction of ExprStmt and StmtExpr

This commit is contained in:
Tamas Vajk
2022-04-07 10:35:48 +02:00
committed by Ian Lynagh
parent 81cb81366b
commit 8282e57db5
7 changed files with 8 additions and 24 deletions

View File

@@ -909,7 +909,8 @@ private module ControlFlowGraphImpl {
)
or
// the last node in an `ExprStmt` is the last node in the expression
last(n.(ExprStmt).getExpr(), last, completion) and completion = NormalCompletion()
last(n.(ExprStmt).getExpr(), last, completion) and
completion instanceof NormalOrBooleanCompletion
or
// the last node in a `StmtExpr` is the last node in the statement
last(n.(StmtExpr).getStmt(), last, completion)
@@ -1232,9 +1233,9 @@ private module ControlFlowGraphImpl {
n = synch and result = first(synch.getBlock())
)
or
result = first(n.(ExprStmt).getExpr()) and completion = NormalCompletion()
result = first(n.(ExprStmt).getExpr()) and completion instanceof NormalOrBooleanCompletion
or
result = first(n.(StmtExpr).getStmt()) and completion = NormalCompletion()
result = first(n.(StmtExpr).getStmt()) and completion instanceof NormalOrBooleanCompletion
or
result = first(n.(LabeledStmt).getStmt()) and completion = NormalCompletion()
or