Skip to content

Commit

Permalink
Fix error and improve getEmbeddedMethods
Browse files Browse the repository at this point in the history
  • Loading branch information
lwfreitas committed Feb 18, 2023
1 parent aa65d39 commit 5544861
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,24 +386,17 @@ func typeSpecs(f *ast.File) []*ast.TypeSpec {
}

func getEmbeddedMethods(t ast.Expr, pr typePrinter, input targetProcessInput) (param genericParam, methods methodsList, err error) {
param.Name, err = pr.PrintType(t)
if err != nil {
return
}

switch v := t.(type) {
case *ast.SelectorExpr:
if x, ok := v.X.(*ast.Ident); ok && x != nil {
param.Name, err = pr.PrintType(x)
if err != nil {
return
}
}

methods, err = processSelector(v, input)
return

case *ast.Ident:
param.Name, err = pr.PrintType(v)
if err != nil {
return
}

methods, err = processIdent(v, input)
return
}
Expand Down

0 comments on commit 5544861

Please sign in to comment.