Skip to content

Commit 5bafa8a

Browse files
authored
Add comment about x, y int being a single ResultVariableDecl
1 parent 351c50a commit 5bafa8a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

go/ql/lib/semmle/go/Decls.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,10 @@ class ReceiverDecl extends FieldBase, Documentable, ExprParent {
667667
* func f4(input string) (output string, err error) { return}
668668
* func f5(e error) (x, y int) { return }
669669
* ```
670+
*
671+
* Note: `x, y int` is a single `ResultVariableDecl` even though it declares
672+
* two different result variables. Use the member predicate `getTypeExpr()` to
673+
* get `int`, `getNameExpr(0)` to get `x` and `getNameExpr(1)` to get `y`.
670674
*/
671675
class ResultVariableDecl extends ParameterOrResultDecl {
672676
ResultVariableDecl() { rawIndex < 0 }

0 commit comments

Comments
 (0)