diff options
author | Bjørn Erik Pedersen <[email protected]> | 2022-12-30 09:20:58 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-01-04 18:01:26 +0100 |
commit | e402d91ee199afcace8ae75da6c3587bb8089ace (patch) | |
tree | a0f51de9707ed03aa1a3d7a9195fd9d0fceab108 /codegen/methods.go | |
parent | 3c51625c7152abca7e035fae15fc6807ca21cc86 (diff) | |
download | hugo-e402d91ee199afcace8ae75da6c3587bb8089ace.tar.gz hugo-e402d91ee199afcace8ae75da6c3587bb8089ace.zip |
Misc doc, code refactoring to improve documentation
Diffstat (limited to 'codegen/methods.go')
-rw-r--r-- | codegen/methods.go | 16 |
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. |