Skip to content

Commit 6897fb4

Browse files
committed
Ruby: Clean up WhenClause CFG
1 parent 57f6894 commit 6897fb4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImpl.qll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,9 @@ module Trees {
13991399
}
14001400

14011401
private class WhenTree extends ControlFlowTree, WhenClause {
1402-
final override predicate propagatesAbnormal(AstNode child) { child = this.getAPattern() }
1402+
final override predicate propagatesAbnormal(AstNode child) {
1403+
child = [this.getAPattern(), this.getBody()]
1404+
}
14031405

14041406
final Expr getLastPattern() {
14051407
exists(int i |
@@ -1415,8 +1417,7 @@ module Trees {
14151417
c.isValidFor(this) and
14161418
c.(ConditionalCompletion).getValue() = false
14171419
or
1418-
last(this.getBody(), last, c) and
1419-
c instanceof NormalCompletion
1420+
last(this.getBody(), last, c)
14201421
}
14211422

14221423
final override predicate succ(AstNode pred, AstNode succ, Completion c) {

0 commit comments

Comments
 (0)