summaryrefslogtreecommitdiffstats
path: root/codegen
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-12-30 09:20:58 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-01-04 18:01:26 +0100
commite402d91ee199afcace8ae75da6c3587bb8089ace (patch)
treea0f51de9707ed03aa1a3d7a9195fd9d0fceab108 /codegen
parent3c51625c7152abca7e035fae15fc6807ca21cc86 (diff)
Misc doc, code refactoring to improve documentation
Diffstat (limited to 'codegen')
-rw-r--r--codegen/methods.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/codegen/methods.go b/codegen/methods.go
index 9bc80cc3e..65a7cc2b7 100644
--- a/codegen/methods.go
+++ b/codegen/methods.go
@@ -452,12 +452,16 @@ func collectMethodsRecursive(pkg string, f []*ast.Field) []string {
}
if ident, ok := m.Type.(*ast.Ident); ok && ident.Obj != nil {
- // Embedded interface
- methodNames = append(
- methodNames,
- collectMethodsRecursive(
- pkg,
- ident.Obj.Decl.(*ast.TypeSpec).Type.(*ast.InterfaceType).Methods.List)...)
+ switch tt := ident.Obj.Decl.(*ast.TypeSpec).Type.(type) {
+ case *ast.InterfaceType:
+ // Embedded interface
+ methodNames = append(
+ methodNames,
+ collectMethodsRecursive(
+ pkg,
+ tt.Methods.List)...)
+ }
+
} else {
// Embedded, but in a different file/package. Return the
// package.Name and deal with that later.