@@ -90,10 +90,10 @@ final class DataFlowCall extends TDataFlowCall {
9090}
9191
9292/**
93- * The position of a parameter or an argument in a function or call .
93+ * The position of a parameter in a function.
9494 *
95- * As there is a 1-to-1 correspondence between parameter positions and
96- * arguments positions in Rust we use the same type for both.
95+ * In Rust there is a 1-to-1 correspondence between parameter positions and
96+ * arguments positions, so we use the same underlying type for both.
9797 */
9898final class ParameterPosition extends TParameterPosition {
9999 /** Gets the underlying integer position, if any. */
@@ -126,6 +126,22 @@ final class ParameterPosition extends TParameterPosition {
126126 }
127127}
128128
129+ /**
130+ * The position of an argument in a call.
131+ *
132+ * In Rust there is a 1-to-1 correspondence between parameter positions and
133+ * arguments positions, so we use the same underlying type for both.
134+ */
135+ final class ArgumentPosition extends ParameterPosition {
136+ /** Gets the argument of `call` at this position, if any. */
137+ Expr getArgument ( CallExprBase call ) {
138+ result = call .getArgList ( ) .getArg ( this .getPosition ( ) )
139+ or
140+ this .isSelf ( ) and
141+ result = call .( MethodCallExpr ) .getReceiver ( )
142+ }
143+ }
144+
129145/** Holds if `call` invokes a qualified path that resolves to a method. */
130146private predicate callToMethod ( CallExpr call ) {
131147 exists ( Path path |
@@ -432,6 +448,8 @@ private module Aliases {
432448
433449 class ParameterPositionAlias = ParameterPosition ;
434450
451+ class ArgumentPositionAlias = ArgumentPosition ;
452+
435453 class ContentAlias = Content ;
436454
437455 class ContentSetAlias = ContentSet ;
@@ -550,7 +568,7 @@ module RustDataFlow implements InputSig<Location> {
550568
551569 class ParameterPosition = ParameterPositionAlias ;
552570
553- class ArgumentPosition = ParameterPosition ;
571+ class ArgumentPosition = ArgumentPositionAlias ;
554572
555573 /**
556574 * Holds if the parameter position `ppos` matches the argument position
0 commit comments