Add comment about x, y int being a single ResultVariableDecl

This commit is contained in:
Owen Mansel-Chan
2024-09-05 10:27:11 +01:00
committed by GitHub
parent 351c50afc1
commit 5bafa8ace2

View File

@@ -667,6 +667,10 @@ class ReceiverDecl extends FieldBase, Documentable, ExprParent {
* func f4(input string) (output string, err error) { return}
* func f5(e error) (x, y int) { return }
* ```
*
* Note: `x, y int` is a single `ResultVariableDecl` even though it declares
* two different result variables. Use the member predicate `getTypeExpr()` to
* get `int`, `getNameExpr(0)` to get `x` and `getNameExpr(1)` to get `y`.
*/
class ResultVariableDecl extends ParameterOrResultDecl {
ResultVariableDecl() { rawIndex < 0 }