Fix: getNumResult() was wrong in some cases

It was the number of result declarations, which is
different from the number of results when one
result declaration declares more than one
variable, as in `x, y int`.
This commit is contained in:
Owen Mansel-Chan
2026-06-08 23:15:55 +02:00
parent da777a455d
commit 8ce543bf4d

View File

@@ -1063,8 +1063,8 @@ class FuncTypeExpr extends @functypeexpr, TypeExpr, ScopeNode, FieldParent {
*/
ResultVariableDecl getAResultDecl() { result = this.getResultDecl(_) }
/** Gets the number of results of this function type. */
int getNumResult() { result = count(this.getAResultDecl()) }
/** Gets the number of result parameters of this function type. */
int getNumResult() { result = count(this.getAResultDecl().getANameExpr()) }
/**
* Gets the result of this function type, if there is only one.