Skip to content

Commit 013ee34

Browse files
authored
Merge pull request #17381 from owen-mc/go/fix/qldoc/resultvariabledecl
Go: Fix QLDoc for ResultVariableDecl
2 parents 28a7fca + 9786934 commit 013ee34

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -649,18 +649,28 @@ class ReceiverDecl extends FieldBase, Documentable, ExprParent {
649649
* Examples:
650650
*
651651
* ```go
652+
* int
653+
* string
652654
* error
653655
* r io.Reader
656+
* output string
657+
* err error
654658
* x, y int
655659
* ```
656660
*
657661
* as in the following code:
658662
*
659663
* ```go
660-
* func f(error) { return nil }
661-
* func g(r io.Reader) { return nil }
662-
* func h(x, y int) { return }
664+
* func f1() int { return 0 }
665+
* func f2(input string) (string, error) { return "", nil }
666+
* func f3(a int) (r io.Reader) { return nil }
667+
* func f4(input string) (output string, err error) { return}
668+
* func f5(e error) (x, y int) { return }
663669
* ```
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`.
664674
*/
665675
class ResultVariableDecl extends ParameterOrResultDecl {
666676
ResultVariableDecl() { rawIndex < 0 }

0 commit comments

Comments
 (0)