Skip to content

Commit 4d3a140

Browse files
committed
Expose whether functions are variadic in their pp() output
1 parent 4dbb15d commit 4d3a140

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

go/ql/lib/semmle/go/Types.qll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -921,9 +921,12 @@ class SignatureType extends @signaturetype, CompositeType {
921921

922922
language[monotonicAggregates]
923923
override string pp() {
924-
result =
925-
"func(" + concat(int i, Type tp | tp = this.getParameterType(i) | tp.pp(), ", " order by i) +
926-
") " + concat(int i, Type tp | tp = this.getResultType(i) | tp.pp(), ", " order by i)
924+
exists(string suffix | (if this.isVariadic() then suffix = "[variadic]" else suffix = "") |
925+
result =
926+
"func(" + concat(int i, Type tp | tp = this.getParameterType(i) | tp.pp(), ", " order by i) +
927+
") " + concat(int i, Type tp | tp = this.getResultType(i) | tp.pp(), ", " order by i) +
928+
" " + suffix
929+
)
927930
}
928931

929932
override string toString() { result = "signature type" }

0 commit comments

Comments
 (0)