findRTForInInterface recursively searches for msgp.RTFor[T] patterns within interface types
(iface *ast.InterfaceType)
| 259 | |
| 260 | // findRTForInInterface recursively searches for msgp.RTFor[T] patterns within interface types |
| 261 | func 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"}. |
no test coverage detected
searching dependent graphs…