Documentation
¶
Index ¶
- func IsGenericFunc(funcDecl *ast.FuncDecl) bool
- func JoinQuoteNames(names []string, sep string) string
- func ParseReceiverInfo(fnName string, receiverType ast.Expr) (identityName string, recvPtr bool, recvGeneric bool, recvType *ast.Ident)
- func ParseReceiverType(typeExpr ast.Expr) (ptr bool, generic bool, recvType *ast.Ident)
- func QuoteNames(names []string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsGenericFunc ¶
func JoinQuoteNames ¶
func ParseReceiverInfo ¶
func ParseReceiverType ¶
ParseReceiverType parses a method receiver type expression, extracting whether it is a pointer receiver, a generic receiver, and the underlying type name as an *ast.Ident.
It handles these receiver forms (all unwrapped to the base type name):
T → ptr=false, generic=false, recv="T" *T → ptr=true, generic=false, recv="T" T[K] → ptr=false, generic=true, recv="T" *T[K] → ptr=true, generic=true, recv="T" pkg.T → ptr=false, generic=false, recv="T" (ast.SelectorExpr) *pkg.T → ptr=true, generic=false, recv="T" (StarExpr→SelectorExpr) *pkg.T[K] → ptr=true, generic=true, recv="T" (StarExpr→IndexExpr→SelectorExpr)
The SelectorExpr case occurs when a method receiver references a type from another package (e.g., *otherpkg.Type). The Go AST represents this as *ast.StarExpr{X: *ast.SelectorExpr{X: pkg, Sel: Type}}. Previously this caused a panic because the function only checked for *ast.Ident after unwrapping pointer and generic wrappers. The fix extracts selExpr.Sel, which is the *ast.Ident for the type name portion (e.g., "Type").
func QuoteNames ¶
Types ¶
This section is empty.