// parseTypeDeclaration creates a tag for type declaration ts and for each // field in case of a struct, or each method in case of an interface. func (p *tagParser) parseTypeDeclaration(ts *ast.TypeSpec) { tag := p.createTag(ts.Name.Name, ts.Pos(), Type) tag.Fields[Access] = getAccess(tag.Name) switch s := ts.Type.(type) { case *ast.StructType: tag.Fields[TypeField] = "struct" p.parseStructFields(tag.Name, s) p.types = append(p.types, tag.Name) case *ast.InterfaceType: tag.Fields[TypeField] = "interface" tag.Type = Interface p.parseInterfaceMethods(tag.Name, s) default: tag.Fields[TypeField] = getType(ts.Type, true) } p.tags = append(p.tags, tag) }