Skip to content

Commit

Permalink
Remove outdated comment
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Dec 14, 2023
1 parent ad6ce04 commit b6322fa
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions compiler/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,14 @@ func functionPath(p *packages.Package, f *ast.FuncDecl) string {
var b strings.Builder
b.WriteString(packagePath(p))
if f.Recv != nil {
b.WriteByte('.')
// https://go.dev/ref/spec#Method_declarations
// > That parameter section must declare a single non-variadic parameter
recvType := p.TypesInfo.Defs[f.Name].Type().(*types.Signature).Recv().Type()
signature := p.TypesInfo.Defs[f.Name].Type().(*types.Signature)
recvType := signature.Recv().Type()
isptr := false
if ptr, ok := recvType.(*types.Pointer); ok {
recvType = ptr.Elem()
isptr = true
}
b.WriteByte('.')
if isptr {
b.WriteString("(*")
}
Expand Down

0 comments on commit b6322fa

Please sign in to comment.