We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents aee1c1c + 16f5662 commit b35dce2Copy full SHA for b35dce2
compiler/astutil/astutil.go
@@ -72,14 +72,16 @@ func FuncKey(d *ast.FuncDecl) string {
72
if d.Recv == nil || len(d.Recv.List) == 0 {
73
return d.Name.Name
74
}
75
+ // Each if-statement progressively unwraps receiver type expression.
76
recv := d.Recv.List[0].Type
- switch r := recv.(type) {
77
- case *ast.StarExpr:
78
- recv = r.X
79
- case *ast.IndexExpr:
80
81
- case *ast.IndexListExpr:
82
+ if star, ok := recv.(*ast.StarExpr); ok {
+ recv = star.X
+ }
+ if index, ok := recv.(*ast.IndexExpr); ok {
+ recv = index.X
83
+ if index, ok := recv.(*ast.IndexListExpr); ok {
84
85
86
return recv.(*ast.Ident).Name + "." + d.Name.Name
87
0 commit comments