mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
Factor out an auxiliary predicate.
This commit is contained in:
@@ -412,6 +412,17 @@ class PostUpdateNode extends Node {
|
||||
Node getPreUpdateNode() { result = preupd }
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the `i`th argument of call `c`, where the receiver of a method call
|
||||
* counts as argument -1.
|
||||
*/
|
||||
private Node getArgument(CallNode c, int i) {
|
||||
result = c.getArgument(i)
|
||||
or
|
||||
result = c.(MethodCallNode).getReceiver() and
|
||||
i = -1
|
||||
}
|
||||
|
||||
/**
|
||||
* A data-flow node that occurs as an argument in a call, including receiver arguments.
|
||||
*/
|
||||
@@ -419,12 +430,7 @@ class ArgumentNode extends Node {
|
||||
CallNode c;
|
||||
int i;
|
||||
|
||||
ArgumentNode() {
|
||||
this = c.getArgument(i)
|
||||
or
|
||||
this = c.(MethodCallNode).getReceiver() and
|
||||
i = -1
|
||||
}
|
||||
ArgumentNode() { this = getArgument(c, i) }
|
||||
|
||||
/**
|
||||
* Holds if this argument occurs at the given position in the given call.
|
||||
|
||||
Reference in New Issue
Block a user