Factor out an auxiliary predicate.

This commit is contained in:
Max Schaefer
2020-03-05 11:46:17 +00:00
parent af2c7aae5d
commit b99c63d180

View File

@@ -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.