Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9735423

Browse files
atorralbaigfoo
authored andcommitted
Fix WhenExpr flow
1 parent 5979981 commit 9735423

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

java/ql/lib/semmle/code/java/ControlFlowGraph.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ private module ControlFlowGraphImpl {
12481248
)
12491249
or
12501250
// When expressions:
1251-
exists(WhenExpr whenexpr | n = whenexpr |
1251+
exists(WhenExpr whenexpr |
12521252
n = whenexpr and
12531253
result = first(whenexpr.getBranch(0)) and
12541254
completion = NormalCompletion()

java/ql/lib/semmle/code/java/dataflow/internal/DataFlowUtil.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ predicate simpleLocalFlowStep(Node node1, Node node2) {
156156
or
157157
node2.asExpr() = any(NotNullExpr nne | node1.asExpr() = nne.getExpr())
158158
or
159+
node2.asExpr().(WhenExpr).getBranch(_).getAResult() = node1.asExpr()
160+
or
159161
exists(MethodAccess ma, ValuePreservingMethod m, int argNo |
160162
ma.getCallee().getSourceDeclaration() = m and m.returnsValue(argNo)
161163
|

0 commit comments

Comments
 (0)