Skip to content

Commit 1ac9e5a

Browse files
committed
Rust: Elaborate QL doc on FunctionPosition class
1 parent ca2838b commit 1ac9e5a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

rust/ql/lib/codeql/rust/internal/typeinference/FunctionType.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ private newtype TFunctionPosition =
1515
* Either `return` or a positional parameter index, where `self` is translated
1616
* to position `0` and subsequent positional parameters at index `i` are
1717
* translated to position `i + 1`.
18+
*
19+
* Function-call adjusted positions are needed when resolving calls of the
20+
* form `Foo::f(x_1, ..., x_n)`, where we do not know up front whether `f` is a
21+
* method or a non-method, and hence we need to be able to match `x_1` against
22+
* both a potential `self` parameter and a potential first positional parameter
23+
* (and `x_2, ... x_n` against all subsequent positional parameters).
1824
*/
1925
class FunctionPosition extends TFunctionPosition {
2026
int asPosition() { result = this.asArgumentPosition().asPosition() }

0 commit comments

Comments
 (0)