mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
CFG: flow for rescue-modifier
This commit is contained in:
@@ -57,6 +57,8 @@ abstract class Completion extends TCompletion {
|
||||
this = TBooleanCompletion(_)
|
||||
)
|
||||
or
|
||||
n = any(RescueModifier parent).getBody() and this = TRaiseCompletion()
|
||||
or
|
||||
not n instanceof NonReturningCall and
|
||||
not completionIsValidForStmt(n, _) and
|
||||
not mustHaveBooleanCompletion(n) and
|
||||
|
||||
@@ -598,6 +598,27 @@ private module Trees {
|
||||
final override AstNode getChildNode(int i) { result = this.getChild() and i = 0 }
|
||||
}
|
||||
|
||||
private class RescueModifierTree extends PreOrderTree, RescueModifier {
|
||||
final override predicate propagatesAbnormal(AstNode child) { child = this.getHandler() }
|
||||
|
||||
final override predicate last(AstNode last, Completion c) {
|
||||
last(this.getBody(), last, c) and
|
||||
not c instanceof RaiseCompletion
|
||||
or
|
||||
last(this.getHandler(), last, c)
|
||||
}
|
||||
|
||||
final override predicate succ(AstNode pred, AstNode succ, Completion c) {
|
||||
pred = this and
|
||||
first(this.getBody(), succ) and
|
||||
c instanceof SimpleCompletion
|
||||
or
|
||||
last(this.getBody(), pred, c) and
|
||||
c instanceof RaiseCompletion and
|
||||
first(this.getHandler(), succ)
|
||||
}
|
||||
}
|
||||
|
||||
private class ReturnTree extends StandardPostOrderTree, Return {
|
||||
final override AstNode getChildNode(int i) { result = this.getChild() and i = 0 }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user