Skip to content

Commit 72df720

Browse files
committed
Ruby: Fix query compilation.
1 parent d902b64 commit 72df720

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

ruby/ql/src/queries/performance/DatabaseQueryInLoop.ql

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import codeql.ruby.ast.internal.Constant
1616
import codeql.ruby.Concepts
1717
import codeql.ruby.frameworks.ActiveRecord
1818
private import codeql.ruby.TaintTracking
19-
private import codeql.ruby.CFG
2019
private import codeql.ruby.controlflow.internal.Guards as Guards
2120

2221
/** Gets the name of a built-in method that involves a loop operation. */
@@ -42,7 +41,7 @@ class LoopingCall extends DataFlow::CallNode {
4241

4342
/** Holds if `ar` influences a guard that may control the execution of a loop. */
4443
predicate usedInLoopControlGuard(ActiveRecordInstance ar) {
45-
exists(DataFlow::Node insideGuard, CfgNodes::ExprCfgNode guard |
44+
exists(DataFlow::Node insideGuard, Cfg::CfgNodes::ExprCfgNode guard |
4645
// For a guard like `cond && ar`, the whole guard will not be tainted
4746
// so we need to look at the taint of the individual parts.
4847
insideGuard.asExpr().getExpr() = guard.getExpr().getAChild*()
@@ -53,12 +52,12 @@ predicate usedInLoopControlGuard(ActiveRecordInstance ar) {
5352
}
5453

5554
/** Holds if `guard` controls `break` and `break` would break out of a loop. */
56-
predicate guardForLoopControl(CfgNodes::ExprCfgNode guard, CfgNodes::AstCfgNode break) {
55+
predicate guardForLoopControl(Cfg::CfgNodes::ExprCfgNode guard, Cfg::CfgNodes::AstCfgNode break) {
5756
Guards::guardControlsBlock(guard, break.getBasicBlock(), _) and
5857
(
59-
break.(CfgNodes::ExprNodes::MethodCallCfgNode).getMethodName() = "raise"
58+
break.(Cfg::CfgNodes::ExprNodes::MethodCallCfgNode).getMethodName() = "raise"
6059
or
61-
break instanceof CfgNodes::ReturningCfgNode
60+
break instanceof Cfg::CfgNodes::ReturningCfgNode
6261
)
6362
}
6463

0 commit comments

Comments
 (0)