Skip to content

Commit f3dcccb

Browse files
committed
Ruby: Add getBlock and getNumberOfArguments predicates to DataFlow::CallNode
1 parent 37d76f5 commit f3dcccb

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPublic.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ class CallNode extends LocalSourceNode {
6161

6262
/** Gets the name of the the method called by the method call (if any) corresponding to this data-flow node */
6363
string getMethodName() { result = node.getExpr().(MethodCall).getMethodName() }
64+
65+
/** Gets the number of arguments of this call. */
66+
int getNumberOfArguments() { result = node.getNumberOfArguments() }
67+
68+
/** Gets the block of this call. */
69+
Node getBlock() { result.asExpr() = node.getBlock() }
6470
}
6571

6672
/**

ruby/ql/lib/codeql/ruby/frameworks/Rails.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ private class CallAgainstConfig extends DataFlow::CallNode {
8484
CallAgainstConfig() { this.getReceiver() instanceof ConfigNode }
8585

8686
MethodCall getCall() { result = this.asExpr().getExpr() }
87-
88-
Block getBlock() { result = this.getCall().getBlock() }
8987
}
9088

9189
private class ActionControllerConfigNode extends DataFlow::Node {

ruby/ql/lib/codeql/ruby/frameworks/StandardLibrary.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ class KernelMethodCall extends DataFlow::CallNode {
2626
)
2727
)
2828
}
29-
30-
int getNumberOfArguments() { result = methodCall.getNumberOfArguments() }
3129
}
3230

3331
/**

0 commit comments

Comments
 (0)