mirror of
https://github.com/github/codeql.git
synced 2026-02-20 08:53:49 +01:00
CFG: Handle ensure blocks without body/rescues
This commit is contained in:
@@ -1101,12 +1101,26 @@ module Trees {
|
||||
.lastEnsure(last, nec.getAnInnerCompatibleCompletion(), nec.getOuterCompletion(),
|
||||
nec.getNestLevel())
|
||||
)
|
||||
or
|
||||
not exists(this.getBodyChild(_, _)) and
|
||||
not exists(this.getRescue(_)) and
|
||||
this.lastEnsure0(last, c)
|
||||
}
|
||||
|
||||
final override predicate succ(AstNode pred, AstNode succ, Completion c) {
|
||||
pred = this and
|
||||
first(this.getBodyChild(0, _), succ) and
|
||||
c instanceof SimpleCompletion
|
||||
c instanceof SimpleCompletion and
|
||||
(
|
||||
first(this.getBodyChild(0, _), succ)
|
||||
or
|
||||
not exists(this.getBodyChild(_, _)) and
|
||||
(
|
||||
first(this.getRescue(0), succ)
|
||||
or
|
||||
not exists(this.getRescue(_)) and
|
||||
first(this.getEnsure(), succ)
|
||||
)
|
||||
)
|
||||
or
|
||||
// Normal left-to-right evaluation in the body
|
||||
exists(int i |
|
||||
|
||||
Reference in New Issue
Block a user