MCPcopy
hub / github.com/tinylib/msgp / findRTForInInterface

Function findRTForInInterface

parse/getast.go:261–280  ·  view source on GitHub ↗

findRTForInInterface recursively searches for msgp.RTFor[T] patterns within interface types

(iface *ast.InterfaceType)

Source from the content-addressed store, hash-verified

259
260// findRTForInInterface recursively searches for msgp.RTFor[T] patterns within interface types
261func findRTForInInterface(iface *ast.InterfaceType) []string {
262 var rtfors []string
263 if iface.Methods == nil {
264 return rtfors
265 }
266
267 for _, method := range iface.Methods.List {
268 // Check if this is an embedded interface/type
269 if len(method.Names) == 0 {
270 if isrtfor(method.Type) {
271 rtfors = append(rtfors, stringify(method.Type))
272 }
273 // Recursively check nested interfaces
274 if nestedIface, ok := method.Type.(*ast.InterfaceType); ok {
275 rtfors = append(rtfors, findRTForInInterface(nestedIface)...)
276 }
277 }
278 }
279 return rtfors
280}
281
282// formatTypeParams converts an AST FieldList to a string representation.
283// For 'Foo[T any, P msgp.RTFor[T]]' will return {"T": "P"}.

Callers 1

getMspTypeParamsFunction · 0.85

Calls 2

isrtforFunction · 0.85
stringifyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…