Skip to content

Commit 0559851

Browse files
committed
Deprecate FuncTypeExpr.getResultDecl()
It is unused in this library. It could easily be used incorrectly and silently omit results when `getNumResult() > 1`.
1 parent cb7b966 commit 0559851

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

go/ql/lib/semmle/go/Expr.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,11 +1067,11 @@ class FuncTypeExpr extends @functypeexpr, TypeExpr, ScopeNode, FieldParent {
10671067
int getNumResult() { result = count(this.getAResultDecl().getANameExpr()) }
10681068

10691069
/**
1070-
* Gets the result of this function type, if there is only one.
1071-
*
1072-
* Note: `x, y int` is a single `ResultVariableDecl`.
1070+
* DEPRECATED: Use `getResultDecl(int i)` instead.
10731071
*/
1074-
ResultVariableDecl getResultDecl() { this.getNumResult() = 1 and result = this.getAResultDecl() }
1072+
deprecated ResultVariableDecl getResultDecl() {
1073+
this.getNumResult() = 1 and result = this.getAResultDecl()
1074+
}
10751075

10761076
override string toString() { result = "function type" }
10771077

0 commit comments

Comments
 (0)