Deprecate FuncTypeExpr.getResultDecl()

It is unused in this library. It could easily be used incorrectly and
silently omit results when `getNumResult() > 1`.
This commit is contained in:
Owen Mansel-Chan
2026-06-08 23:18:37 +02:00
parent 8ce543bf4d
commit a92349683e

View File

@@ -1067,11 +1067,11 @@ class FuncTypeExpr extends @functypeexpr, TypeExpr, ScopeNode, FieldParent {
int getNumResult() { result = count(this.getAResultDecl().getANameExpr()) }
/**
* Gets the result of this function type, if there is only one.
*
* Note: `x, y int` is a single `ResultVariableDecl`.
* DEPRECATED: Use `getResultDecl(int i)` instead.
*/
ResultVariableDecl getResultDecl() { this.getNumResult() = 1 and result = this.getAResultDecl() }
deprecated ResultVariableDecl getResultDecl() {
this.getNumResult() = 1 and result = this.getAResultDecl()
}
override string toString() { result = "function type" }