mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
Ruby: Add getPositionalArgument
This gets positional arguments from a call. These are arguments which are not keyword arguments.
This commit is contained in:
@@ -357,6 +357,14 @@ module ExprNodes {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the `nth` positional argument of this call.
|
||||
* Unlike `getArgument`, this excludes keyword arguments.
|
||||
*/
|
||||
final ExprCfgNode getPositionalArgument(int n) {
|
||||
result = this.getArgument(n) and not result instanceof PairCfgNode
|
||||
}
|
||||
|
||||
/** Gets the number of arguments of this call. */
|
||||
final int getNumberOfArguments() { result = e.getNumberOfArguments() }
|
||||
|
||||
|
||||
@@ -71,6 +71,14 @@ class CallNode extends LocalSourceNode, ExprNode {
|
||||
/** Gets the data-flow node corresponding to the named argument of the call corresponding to this data-flow node */
|
||||
ExprNode getKeywordArgument(string name) { result.getExprNode() = node.getKeywordArgument(name) }
|
||||
|
||||
/**
|
||||
* Gets the `nth` positional argument of this call.
|
||||
* Unlike `getArgument`, this excludes keyword arguments.
|
||||
*/
|
||||
final ExprNode getPositionalArgument(int n) {
|
||||
result.getExprNode() = node.getPositionalArgument(n)
|
||||
}
|
||||
|
||||
/** Gets the name of the the method called by the method call (if any) corresponding to this data-flow node */
|
||||
string getMethodName() { result = node.getExpr().(MethodCall).getMethodName() }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user