@@ -551,7 +551,7 @@ module Public {
551
551
}
552
552
553
553
/**
554
- * Gets the data flow node corresponding to an argument of this call, where
554
+ * Gets a data flow node corresponding to an argument of this call, where
555
555
* tuple extraction has been done but arguments corresponding to a variadic
556
556
* parameter are still considered separate.
557
557
*/
@@ -567,20 +567,17 @@ module Public {
567
567
* For calls of the form `f(g())` where `g` has multiple results, the arguments of the call to
568
568
* `i` are the (implicit) element extraction nodes for the call to `g`.
569
569
*
570
- * For calls to variadic functions without an ellipsis (`...`), there is a single argument of type
571
- * `ImplicitVarargsSlice` corresponding to the variadic parameter. This is in contrast to the member
572
- * predicate `getArgument` on `CallExpr`, which gets the syntactic arguments.
570
+ * Returns a single `Node` corresponding to a variadic parameter. If there is no corresponding
571
+ * argument with an ellipsis (`...`), then it is a `ImplicitVarargsSlice`. This is in contrast
572
+ * to `getArgument` on `CallExpr`, which gets the syntactic arguments. Use
573
+ * `getSyntacticArgument` to get that behavior.
573
574
*/
574
575
Node getArgument ( int i ) {
575
- exists ( int lastParamIndex | lastParamIndex = expr .getCalleeType ( ) .getNumParameter ( ) - 1 |
576
- if
577
- expr .hasImplicitVarargs ( ) and
578
- i >= lastParamIndex
579
- then
580
- result .( ImplicitVarargsSlice ) .getCallNode ( ) = this and
581
- i = lastParamIndex
582
- else result = this .getSyntacticArgument ( i )
583
- )
576
+ result = this .getSyntacticArgument ( i ) and
577
+ not ( expr .hasImplicitVarargs ( ) and i >= expr .getCalleeType ( ) .getNumParameter ( ) - 1 )
578
+ or
579
+ i = expr .getCalleeType ( ) .getNumParameter ( ) - 1 and
580
+ result .( ImplicitVarargsSlice ) .getCallNode ( ) = this
584
581
}
585
582
586
583
/** Gets the data flow node corresponding to an argument of this call. */
0 commit comments