Skip to content

Commit

Permalink
it works!
Browse files Browse the repository at this point in the history
  • Loading branch information
DQNEO committed Aug 19, 2023
1 parent e0ced95 commit 103fcf5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions internal/sema/sema.go
Original file line number Diff line number Diff line change
Expand Up @@ -2658,6 +2658,16 @@ func SerializeType2(goType types.GoType, showPkgPrefix bool, showOnlyForeignPref
return "map[" + SerializeType2(g.Key(), showPkgPrefix, showOnlyForeignPrefix, currentPkgName) + "]" + SerializeType2(g.Elem(), showPkgPrefix, showOnlyForeignPrefix, currentPkgName)
case *types.Func:
return "func()"
case *types.Struct:
r := "struct{"
if len(g.Fields) > 0 {
for _, field := range g.Fields {
name := field.Name
typ := field.Typ
r += fmt.Sprintf("%s %s; ", name, SerializeType2(typ, showPkgPrefix, showOnlyForeignPrefix, currentPkgName))
}
}
return r + "}"
case *types.Interface:
if len(g.Methods) == 0 {
return "interface{}"
Expand Down Expand Up @@ -2702,12 +2712,15 @@ func SerializeType(t *types.Type, showPkgPrefix bool, showOnlyForeignPrefix bool
return SerializeType2(t.GoType, showPkgPrefix, showOnlyForeignPrefix, currentPkgName)
case *types.Map:
return SerializeType2(t.GoType, showPkgPrefix, showOnlyForeignPrefix, currentPkgName)
case *types.Struct:
return SerializeType2(t.GoType, showPkgPrefix, showOnlyForeignPrefix, currentPkgName)
}

switch e := t.E.(type) {
case *ast.Ident:
panic("should not reach here")
case *ast.StructType:
panic("should not reach here")
r := "struct{"
if e.Fields != nil {
for _, field := range e.Fields.List {
Expand Down

0 comments on commit 103fcf5

Please sign in to comment.