internal/symbols: compute names for index list expression receivers
This is part of computation of the name of the function in vuln. db
format. For "func (A[T1, T1, T3]) Foo", the name should be "A.Foo".
Change-Id: Iaeb7eccf3d72504484e697de972297ff37481255
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/586719
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Maceo Thompson <maceothompson@google.com>
diff --git a/internal/symbols/patched_functions.go b/internal/symbols/patched_functions.go
index 8a9e23d..d470541 100644
--- a/internal/symbols/patched_functions.go
+++ b/internal/symbols/patched_functions.go
@@ -422,13 +422,15 @@
return ""
}
- // supported receiver type snames are id, *id, id[...], and *id[...].
+ // supported receiver type names are id, *id, id[...], and *id[...].
t := ""
switch xv := field.Type.(type) {
case *ast.StarExpr:
t = unpackIdent(xv.X)
case *ast.Ident, *ast.IndexExpr:
t = unpackIdent(xv)
+ case *ast.IndexListExpr:
+ t = unpackIdent(xv.X)
default:
panic(fmt.Sprintf("astSymbolName: unexpected receiver type: %v\n", reflect.TypeOf(field.Type)))
}