File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
ruby/ql/lib/codeql/ruby/controlflow/internal Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -71,19 +71,23 @@ private predicate completionIsValidForStmt(AstNode n, Completion c) {
71
71
c = TReturnCompletion ( )
72
72
}
73
73
74
- /**
75
- * Holds if `c` happens in an exception-aware context, that is, it may be
76
- * `rescue`d or `ensure`d. In such cases, we assume that the target of `c`
77
- * may raise an exception (in addition to evaluating normally).
78
- */
79
- private predicate mayRaise ( Call c ) {
80
- exists ( Trees:: BodyStmtTree bst | c = bst .getBodyChild ( _, true ) .getAChild * ( ) |
74
+ private AstNode getARescuableBodyChild ( ) {
75
+ exists ( Trees:: BodyStmtTree bst | result = bst .getBodyChild ( _, true ) |
81
76
exists ( bst .getARescue ( ) )
82
77
or
83
78
exists ( bst .getEnsure ( ) )
84
79
)
80
+ or
81
+ result = getARescuableBodyChild ( ) .getAChild ( )
85
82
}
86
83
84
+ /**
85
+ * Holds if `c` happens in an exception-aware context, that is, it may be
86
+ * `rescue`d or `ensure`d. In such cases, we assume that the target of `c`
87
+ * may raise an exception (in addition to evaluating normally).
88
+ */
89
+ private predicate mayRaise ( Call c ) { c = getARescuableBodyChild ( ) }
90
+
87
91
/** A completion of a statement or an expression. */
88
92
abstract class Completion extends TCompletion {
89
93
private predicate isValidForSpecific ( AstNode n ) {
You can’t perform that action at this time.
0 commit comments