internal/descfmt: rename from typefmt

The name descfmt more closely matches the fact that this package
provides pretty-printing for descriptors.

Change-Id: I11b0e4a0302962ee7bbf315fb259d050847cadbb
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/178479
Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
Joe Tsai 2019-05-22 05:22:04 -04:00 committed by Joe Tsai
parent 095e23da31
commit 63bdd1f864
13 changed files with 84 additions and 84 deletions

View File

@ -193,7 +193,7 @@ var listTypesTemplate = template.Must(template.New("").Funcs(template.FuncMap{
return {{$nameDesc}}{t}
}
{{- end}}
func (p *{{$nameList}}) Format(s fmt.State, r rune) { typefmt.FormatList(s, r, p) }
func (p *{{$nameList}}) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *{{$nameList}}) ProtoInternal(pragma.DoNotImplement) {}
{{- end}}
`))
@ -262,7 +262,7 @@ var fileinitDescListTemplate = template.Must(template.New("").Funcs(template.Fun
}
{{- end}}
func (p *{{$nameList}}) Format(s fmt.State, r rune) {
typefmt.FormatList(s, r, p)
descfmt.FormatList(s, r, p)
}
func (p *{{$nameList}}) ProtoInternal(pragma.DoNotImplement) {}
func (p *{{$nameList}}) lazyInit() *{{$nameList}} {
@ -316,10 +316,10 @@ func writeSource(file, src string) {
"sync",
"unicode/utf8",
"",
"google.golang.org/protobuf/internal/descfmt",
"google.golang.org/protobuf/internal/encoding/wire",
"google.golang.org/protobuf/internal/errors",
"google.golang.org/protobuf/internal/pragma",
"google.golang.org/protobuf/internal/typefmt",
"google.golang.org/protobuf/reflect/protoreflect",
"google.golang.org/protobuf/runtime/protoiface",
} {

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package typefmt
package descfmt
import (
"testing"

View File

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package typefmt provides functionality to format descriptors.
package typefmt
// Package descfmt provides functionality to format descriptors.
package descfmt
import (
"fmt"

View File

@ -13,10 +13,10 @@ import (
"reflect"
"sync"
descopts "google.golang.org/protobuf/internal/descopts"
"google.golang.org/protobuf/internal/descfmt"
"google.golang.org/protobuf/internal/descopts"
pimpl "google.golang.org/protobuf/internal/impl"
pragma "google.golang.org/protobuf/internal/pragma"
pfmt "google.golang.org/protobuf/internal/typefmt"
"google.golang.org/protobuf/internal/pragma"
"google.golang.org/protobuf/proto"
pref "google.golang.org/protobuf/reflect/protoreflect"
preg "google.golang.org/protobuf/reflect/protoregistry"
@ -267,7 +267,7 @@ func (fd *fileDesc) Enums() pref.EnumDescriptors { return &fd.enums }
func (fd *fileDesc) Messages() pref.MessageDescriptors { return &fd.messages }
func (fd *fileDesc) Extensions() pref.ExtensionDescriptors { return &fd.extensions }
func (fd *fileDesc) Services() pref.ServiceDescriptors { return &fd.services }
func (fd *fileDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, fd) }
func (fd *fileDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
func (fd *fileDesc) ProtoType(pref.FileDescriptor) {}
func (fd *fileDesc) ProtoInternal(pragma.DoNotImplement) {}
@ -312,7 +312,7 @@ func (ed *enumDesc) Options() pref.ProtoMessage {
func (ed *enumDesc) Values() pref.EnumValueDescriptors { return &ed.lazyInit().values }
func (ed *enumDesc) ReservedNames() pref.Names { return &ed.lazyInit().resvNames }
func (ed *enumDesc) ReservedRanges() pref.EnumRanges { return &ed.lazyInit().resvRanges }
func (ed *enumDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, ed) }
func (ed *enumDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
func (ed *enumDesc) ProtoType(pref.EnumDescriptor) {}
func (ed *enumDesc) lazyInit() *enumLazy {
ed.parentFile.lazyInit() // implicitly initializes enumLazy
@ -323,7 +323,7 @@ func (ed *enumValueDesc) Options() pref.ProtoMessage {
return unmarshalOptions(descopts.EnumValue, ed.options)
}
func (ed *enumValueDesc) Number() pref.EnumNumber { return ed.number }
func (ed *enumValueDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, ed) }
func (ed *enumValueDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
func (ed *enumValueDesc) ProtoType(pref.EnumValueDescriptor) {}
type (
@ -399,7 +399,7 @@ func (md *messageDesc) Enums() pref.EnumDescriptors { return &md.enums
func (md *messageDesc) Messages() pref.MessageDescriptors { return &md.messages }
func (md *messageDesc) Extensions() pref.ExtensionDescriptors { return &md.extensions }
func (md *messageDesc) ProtoType(pref.MessageDescriptor) {}
func (md *messageDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, md.asDesc()) }
func (md *messageDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md.asDesc()) }
func (md *messageDesc) lazyInit() *messageLazy {
md.parentFile.lazyInit() // implicitly initializes messageLazy
return md.lazy
@ -462,7 +462,7 @@ func (fd *fieldDesc) ContainingMessage() pref.MessageDescriptor {
}
func (fd *fieldDesc) Enum() pref.EnumDescriptor { return fd.enumType }
func (fd *fieldDesc) Message() pref.MessageDescriptor { return fd.messageType }
func (fd *fieldDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, fd) }
func (fd *fieldDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
func (fd *fieldDesc) ProtoType(pref.FieldDescriptor) {}
// TODO: Remove this.
@ -473,7 +473,7 @@ func (od *oneofDesc) Options() pref.ProtoMessage {
return unmarshalOptions(descopts.Oneof, od.options)
}
func (od *oneofDesc) Fields() pref.FieldDescriptors { return &od.fields }
func (od *oneofDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, od) }
func (od *oneofDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, od) }
func (od *oneofDesc) ProtoType(pref.OneofDescriptor) {}
type (
@ -538,7 +538,7 @@ func (xd *extensionDesc) ContainingOneof() pref.OneofDescriptor { return ni
func (xd *extensionDesc) ContainingMessage() pref.MessageDescriptor { return xd.extendedType }
func (xd *extensionDesc) Enum() pref.EnumDescriptor { return xd.lazyInit().enumType }
func (xd *extensionDesc) Message() pref.MessageDescriptor { return xd.lazyInit().messageType }
func (xd *extensionDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, xd) }
func (xd *extensionDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, xd) }
func (xd *extensionDesc) ProtoType(pref.FieldDescriptor) {}
func (xd *extensionDesc) ProtoInternal(pragma.DoNotImplement) {}
func (xd *extensionDesc) lazyInit() *extensionLazy {
@ -584,7 +584,7 @@ func (sd *serviceDesc) Options() pref.ProtoMessage {
return unmarshalOptions(descopts.Service, sd.lazyInit().options)
}
func (sd *serviceDesc) Methods() pref.MethodDescriptors { return &sd.lazyInit().methods }
func (sd *serviceDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, sd) }
func (sd *serviceDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, sd) }
func (sd *serviceDesc) ProtoType(pref.ServiceDescriptor) {}
func (sd *serviceDesc) ProtoInternal(pragma.DoNotImplement) {}
func (sd *serviceDesc) lazyInit() *serviceLazy {
@ -599,7 +599,7 @@ func (md *methodDesc) Input() pref.MessageDescriptor { return md.inputType
func (md *methodDesc) Output() pref.MessageDescriptor { return md.outputType }
func (md *methodDesc) IsStreamingClient() bool { return md.isStreamingClient }
func (md *methodDesc) IsStreamingServer() bool { return md.isStreamingServer }
func (md *methodDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, md) }
func (md *methodDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
func (md *methodDesc) ProtoType(pref.MethodDescriptor) {}
func (md *methodDesc) ProtoInternal(pragma.DoNotImplement) {}

View File

@ -9,8 +9,8 @@ import (
"sort"
"sync"
pragma "google.golang.org/protobuf/internal/pragma"
pfmt "google.golang.org/protobuf/internal/typefmt"
"google.golang.org/protobuf/internal/descfmt"
"google.golang.org/protobuf/internal/pragma"
pref "google.golang.org/protobuf/reflect/protoreflect"
)
@ -18,7 +18,7 @@ type fileImports []pref.FileImport
func (p *fileImports) Len() int { return len(*p) }
func (p *fileImports) Get(i int) pref.FileImport { return (*p)[i] }
func (p *fileImports) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
func (p *fileImports) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *fileImports) ProtoInternal(pragma.DoNotImplement) {}
type names struct {
@ -41,7 +41,7 @@ func (p *names) Has(s pref.Name) bool {
_, ok := p.has[s]
return ok
}
func (p *names) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
func (p *names) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *names) ProtoInternal(pragma.DoNotImplement) {}
type enumRanges struct {
@ -85,7 +85,7 @@ func (p *enumRanges) Has(n pref.EnumNumber) bool {
}
return false
}
func (p *enumRanges) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
func (p *enumRanges) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *enumRanges) ProtoInternal(pragma.DoNotImplement) {}
type fieldRanges struct {
@ -129,7 +129,7 @@ func (p *fieldRanges) Has(n pref.FieldNumber) bool {
}
return false
}
func (p *fieldRanges) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
func (p *fieldRanges) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *fieldRanges) ProtoInternal(pragma.DoNotImplement) {}
type fieldNumbers struct {
@ -152,7 +152,7 @@ func (p *fieldNumbers) Has(n pref.FieldNumber) bool {
_, ok := p.has[n]
return ok
}
func (p *fieldNumbers) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
func (p *fieldNumbers) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *fieldNumbers) ProtoInternal(pragma.DoNotImplement) {}
type oneofFields struct {
@ -168,7 +168,7 @@ func (p *oneofFields) Get(i int) pref.FieldDescriptor { return
func (p *oneofFields) ByName(s pref.Name) pref.FieldDescriptor { return p.lazyInit().byName[s] }
func (p *oneofFields) ByJSONName(s string) pref.FieldDescriptor { return p.lazyInit().byJSON[s] }
func (p *oneofFields) ByNumber(n pref.FieldNumber) pref.FieldDescriptor { return p.lazyInit().byNum[n] }
func (p *oneofFields) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
func (p *oneofFields) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *oneofFields) ProtoInternal(pragma.DoNotImplement) {}
func (p *oneofFields) lazyInit() *oneofFields {

View File

@ -10,8 +10,8 @@ import (
"fmt"
"sync"
"google.golang.org/protobuf/internal/descfmt"
"google.golang.org/protobuf/internal/pragma"
"google.golang.org/protobuf/internal/typefmt"
"google.golang.org/protobuf/reflect/protoreflect"
)
@ -34,7 +34,7 @@ func (p *enumDescs) ByName(s protoreflect.Name) protoreflect.EnumDescriptor {
return nil
}
func (p *enumDescs) Format(s fmt.State, r rune) {
typefmt.FormatList(s, r, p)
descfmt.FormatList(s, r, p)
}
func (p *enumDescs) ProtoInternal(pragma.DoNotImplement) {}
func (p *enumDescs) lazyInit() *enumDescs {
@ -78,7 +78,7 @@ func (p *enumValueDescs) ByNumber(n protoreflect.EnumNumber) protoreflect.EnumVa
return nil
}
func (p *enumValueDescs) Format(s fmt.State, r rune) {
typefmt.FormatList(s, r, p)
descfmt.FormatList(s, r, p)
}
func (p *enumValueDescs) ProtoInternal(pragma.DoNotImplement) {}
func (p *enumValueDescs) lazyInit() *enumValueDescs {
@ -119,7 +119,7 @@ func (p *messageDescs) ByName(s protoreflect.Name) protoreflect.MessageDescripto
return nil
}
func (p *messageDescs) Format(s fmt.State, r rune) {
typefmt.FormatList(s, r, p)
descfmt.FormatList(s, r, p)
}
func (p *messageDescs) ProtoInternal(pragma.DoNotImplement) {}
func (p *messageDescs) lazyInit() *messageDescs {
@ -170,7 +170,7 @@ func (p *fieldDescs) ByNumber(n protoreflect.FieldNumber) protoreflect.FieldDesc
return nil
}
func (p *fieldDescs) Format(s fmt.State, r rune) {
typefmt.FormatList(s, r, p)
descfmt.FormatList(s, r, p)
}
func (p *fieldDescs) ProtoInternal(pragma.DoNotImplement) {}
func (p *fieldDescs) lazyInit() *fieldDescs {
@ -215,7 +215,7 @@ func (p *oneofDescs) ByName(s protoreflect.Name) protoreflect.OneofDescriptor {
return nil
}
func (p *oneofDescs) Format(s fmt.State, r rune) {
typefmt.FormatList(s, r, p)
descfmt.FormatList(s, r, p)
}
func (p *oneofDescs) ProtoInternal(pragma.DoNotImplement) {}
func (p *oneofDescs) lazyInit() *oneofDescs {
@ -252,7 +252,7 @@ func (p *extensionDescs) ByName(s protoreflect.Name) protoreflect.ExtensionDescr
return nil
}
func (p *extensionDescs) Format(s fmt.State, r rune) {
typefmt.FormatList(s, r, p)
descfmt.FormatList(s, r, p)
}
func (p *extensionDescs) ProtoInternal(pragma.DoNotImplement) {}
func (p *extensionDescs) lazyInit() *extensionDescs {
@ -289,7 +289,7 @@ func (p *serviceDescs) ByName(s protoreflect.Name) protoreflect.ServiceDescripto
return nil
}
func (p *serviceDescs) Format(s fmt.State, r rune) {
typefmt.FormatList(s, r, p)
descfmt.FormatList(s, r, p)
}
func (p *serviceDescs) ProtoInternal(pragma.DoNotImplement) {}
func (p *serviceDescs) lazyInit() *serviceDescs {
@ -326,7 +326,7 @@ func (p *methodDescs) ByName(s protoreflect.Name) protoreflect.MethodDescriptor
return nil
}
func (p *methodDescs) Format(s fmt.State, r rune) {
typefmt.FormatList(s, r, p)
descfmt.FormatList(s, r, p)
}
func (p *methodDescs) ProtoInternal(pragma.DoNotImplement) {}
func (p *methodDescs) lazyInit() *methodDescs {

View File

@ -9,10 +9,10 @@ import (
"reflect"
"sync"
"google.golang.org/protobuf/internal/descfmt"
ptag "google.golang.org/protobuf/internal/encoding/tag"
pimpl "google.golang.org/protobuf/internal/impl"
ptype "google.golang.org/protobuf/internal/prototype"
pfmt "google.golang.org/protobuf/internal/typefmt"
pvalue "google.golang.org/protobuf/internal/value"
pref "google.golang.org/protobuf/reflect/protoreflect"
preg "google.golang.org/protobuf/reflect/protoregistry"
@ -276,4 +276,4 @@ func (x *extensionType) GoType() reflect.Type { return x.typ }
func (x *extensionType) New() pref.Value { return x.new() }
func (x *extensionType) ValueOf(v interface{}) pref.Value { return x.valueOf(v) }
func (x *extensionType) InterfaceOf(v pref.Value) interface{} { return x.interfaceOf(v) }
func (x *extensionType) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, x.Descriptor()) }
func (x *extensionType) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, x.Descriptor()) }

View File

@ -9,7 +9,7 @@ import (
"reflect"
"sync"
"google.golang.org/protobuf/internal/typefmt"
"google.golang.org/protobuf/internal/descfmt"
"google.golang.org/protobuf/internal/value"
"google.golang.org/protobuf/reflect/protoreflect"
)
@ -47,7 +47,7 @@ func (t *goEnum) New(n protoreflect.EnumNumber) protoreflect.Enum {
return e
}
func (t *goEnum) Format(s fmt.State, r rune) {
typefmt.FormatDesc(s, r, t)
descfmt.FormatDesc(s, r, t)
}
// GoMessage creates a new protoreflect.MessageType by combining the provided
@ -86,7 +86,7 @@ func (t *goMessage) New() protoreflect.Message {
return m
}
func (t *goMessage) Format(s fmt.State, r rune) {
typefmt.FormatDesc(s, r, t)
descfmt.FormatDesc(s, r, t)
}
// GoExtension creates a new protoreflect.ExtensionType.
@ -212,7 +212,7 @@ func (t *goExtension) InterfaceOf(pv protoreflect.Value) interface{} {
return v
}
func (t *goExtension) Format(s fmt.State, r rune) {
typefmt.FormatDesc(s, r, t)
descfmt.FormatDesc(s, r, t)
}
func (t *goExtension) lazyInit() {
t.once.Do(func() {

View File

@ -7,9 +7,9 @@ package prototype
import (
"fmt"
descopts "google.golang.org/protobuf/internal/descopts"
pragma "google.golang.org/protobuf/internal/pragma"
pfmt "google.golang.org/protobuf/internal/typefmt"
descfmt "google.golang.org/protobuf/internal/descfmt"
"google.golang.org/protobuf/internal/descopts"
"google.golang.org/protobuf/internal/pragma"
pref "google.golang.org/protobuf/reflect/protoreflect"
)
@ -53,7 +53,7 @@ func (t placeholderFile) Enums() pref.EnumDescriptors { return &emptyE
func (t placeholderFile) Messages() pref.MessageDescriptors { return &emptyMessages }
func (t placeholderFile) Extensions() pref.ExtensionDescriptors { return &emptyExtensions }
func (t placeholderFile) Services() pref.ServiceDescriptors { return &emptyServices }
func (t placeholderFile) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t placeholderFile) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t placeholderFile) ProtoType(pref.FileDescriptor) {}
type placeholderMessage struct {
@ -72,7 +72,7 @@ func (t placeholderMessage) ExtensionRangeOptions(int) pref.ProtoMessage { panic
func (t placeholderMessage) Enums() pref.EnumDescriptors { return &emptyEnums }
func (t placeholderMessage) Messages() pref.MessageDescriptors { return &emptyMessages }
func (t placeholderMessage) Extensions() pref.ExtensionDescriptors { return &emptyExtensions }
func (t placeholderMessage) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t placeholderMessage) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t placeholderMessage) ProtoType(pref.MessageDescriptor) {}
type placeholderEnum struct {
@ -83,5 +83,5 @@ func (t placeholderEnum) Options() pref.ProtoMessage { return descopts.En
func (t placeholderEnum) Values() pref.EnumValueDescriptors { return &emptyEnumValues }
func (t placeholderEnum) ReservedNames() pref.Names { return &emptyNames }
func (t placeholderEnum) ReservedRanges() pref.EnumRanges { return &emptyEnumRanges }
func (t placeholderEnum) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t placeholderEnum) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t placeholderEnum) ProtoType(pref.EnumDescriptor) {}

View File

@ -8,9 +8,9 @@ import (
"fmt"
"sync"
pragma "google.golang.org/protobuf/internal/pragma"
pset "google.golang.org/protobuf/internal/set"
pfmt "google.golang.org/protobuf/internal/typefmt"
"google.golang.org/protobuf/internal/descfmt"
"google.golang.org/protobuf/internal/pragma"
"google.golang.org/protobuf/internal/set"
pref "google.golang.org/protobuf/reflect/protoreflect"
)
@ -26,7 +26,7 @@ func (p *names) Has(s pref.Name) bool {
}
return false
}
func (p *names) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
func (p *names) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *names) ProtoInternal(pragma.DoNotImplement) {}
// Names returns a Names list from a slice of names.
@ -35,7 +35,7 @@ func Names(s []pref.Name) pref.Names { return (*names)(&s) }
type numbersMeta struct {
once sync.Once
ns []pref.FieldNumber
nss pset.Ints
nss set.Ints
}
type numbers numbersMeta
@ -53,7 +53,7 @@ func (p *numbersMeta) lazyInit(fs []Field) *numbers {
func (p *numbers) Len() int { return len(p.ns) }
func (p *numbers) Get(i int) pref.FieldNumber { return p.ns[i] }
func (p *numbers) Has(n pref.FieldNumber) bool { return p.nss.Has(uint64(n)) }
func (p *numbers) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
func (p *numbers) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *numbers) ProtoInternal(pragma.DoNotImplement) {}
type fieldRanges [][2]pref.FieldNumber
@ -68,7 +68,7 @@ func (p *fieldRanges) Has(n pref.FieldNumber) bool {
}
return false
}
func (p *fieldRanges) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
func (p *fieldRanges) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *fieldRanges) ProtoInternal(pragma.DoNotImplement) {}
// FieldRanges returns a FieldRanges list from a slice of ranges.
@ -86,7 +86,7 @@ func (p *enumRanges) Has(n pref.EnumNumber) bool {
}
return false
}
func (p *enumRanges) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
func (p *enumRanges) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *enumRanges) ProtoInternal(pragma.DoNotImplement) {}
// EnumRanges returns an EnumRanges list from a slice of ranges.
@ -96,7 +96,7 @@ type fileImports []pref.FileImport
func (p *fileImports) Len() int { return len(*p) }
func (p *fileImports) Get(i int) pref.FileImport { return (*p)[i] }
func (p *fileImports) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
func (p *fileImports) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *fileImports) ProtoInternal(pragma.DoNotImplement) {}
type oneofFieldsMeta struct {
@ -136,5 +136,5 @@ func (p *oneofFields) Get(i int) pref.FieldDescriptor { return
func (p *oneofFields) ByName(s pref.Name) pref.FieldDescriptor { return p.byName[s] }
func (p *oneofFields) ByJSONName(s string) pref.FieldDescriptor { return p.byJSON[s] }
func (p *oneofFields) ByNumber(n pref.FieldNumber) pref.FieldDescriptor { return p.byNum[n] }
func (p *oneofFields) Format(s fmt.State, r rune) { pfmt.FormatList(s, r, p) }
func (p *oneofFields) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *oneofFields) ProtoInternal(pragma.DoNotImplement) {}

View File

@ -10,8 +10,8 @@ import (
"fmt"
"sync"
"google.golang.org/protobuf/internal/descfmt"
"google.golang.org/protobuf/internal/pragma"
"google.golang.org/protobuf/internal/typefmt"
"google.golang.org/protobuf/reflect/protoreflect"
)
@ -58,7 +58,7 @@ func (p *messages) ByName(s protoreflect.Name) protoreflect.MessageDescriptor {
}
return messageDesc{t}
}
func (p *messages) Format(s fmt.State, r rune) { typefmt.FormatList(s, r, p) }
func (p *messages) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *messages) ProtoInternal(pragma.DoNotImplement) {}
type fieldsMeta struct {
@ -145,7 +145,7 @@ func (p *fields) ByNumber(n protoreflect.FieldNumber) protoreflect.FieldDescript
}
return fieldDesc{t}
}
func (p *fields) Format(s fmt.State, r rune) { typefmt.FormatList(s, r, p) }
func (p *fields) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *fields) ProtoInternal(pragma.DoNotImplement) {}
type oneofsMeta struct {
@ -191,7 +191,7 @@ func (p *oneofs) ByName(s protoreflect.Name) protoreflect.OneofDescriptor {
}
return oneofDesc{t}
}
func (p *oneofs) Format(s fmt.State, r rune) { typefmt.FormatList(s, r, p) }
func (p *oneofs) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *oneofs) ProtoInternal(pragma.DoNotImplement) {}
type extensionsMeta struct {
@ -237,7 +237,7 @@ func (p *extensions) ByName(s protoreflect.Name) protoreflect.ExtensionDescripto
}
return extensionDesc{t}
}
func (p *extensions) Format(s fmt.State, r rune) { typefmt.FormatList(s, r, p) }
func (p *extensions) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *extensions) ProtoInternal(pragma.DoNotImplement) {}
type enumsMeta struct {
@ -283,7 +283,7 @@ func (p *enums) ByName(s protoreflect.Name) protoreflect.EnumDescriptor {
}
return enumDesc{t}
}
func (p *enums) Format(s fmt.State, r rune) { typefmt.FormatList(s, r, p) }
func (p *enums) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *enums) ProtoInternal(pragma.DoNotImplement) {}
type enumValuesMeta struct {
@ -349,7 +349,7 @@ func (p *enumValues) ByNumber(n protoreflect.EnumNumber) protoreflect.EnumValueD
}
return enumValueDesc{t}
}
func (p *enumValues) Format(s fmt.State, r rune) { typefmt.FormatList(s, r, p) }
func (p *enumValues) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *enumValues) ProtoInternal(pragma.DoNotImplement) {}
type servicesMeta struct {
@ -395,7 +395,7 @@ func (p *services) ByName(s protoreflect.Name) protoreflect.ServiceDescriptor {
}
return serviceDesc{t}
}
func (p *services) Format(s fmt.State, r rune) { typefmt.FormatList(s, r, p) }
func (p *services) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *services) ProtoInternal(pragma.DoNotImplement) {}
type methodsMeta struct {
@ -441,5 +441,5 @@ func (p *methods) ByName(s protoreflect.Name) protoreflect.MethodDescriptor {
}
return methodDesc{t}
}
func (p *methods) Format(s fmt.State, r rune) { typefmt.FormatList(s, r, p) }
func (p *methods) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
func (p *methods) ProtoInternal(pragma.DoNotImplement) {}

View File

@ -10,9 +10,9 @@ import (
"strings"
"sync"
descopts "google.golang.org/protobuf/internal/descopts"
pragma "google.golang.org/protobuf/internal/pragma"
pfmt "google.golang.org/protobuf/internal/typefmt"
"google.golang.org/protobuf/internal/descfmt"
"google.golang.org/protobuf/internal/descopts"
"google.golang.org/protobuf/internal/pragma"
"google.golang.org/protobuf/reflect/protoreflect"
pref "google.golang.org/protobuf/reflect/protoreflect"
)
@ -78,7 +78,7 @@ func (t fileDesc) Enums() pref.EnumDescriptors { return t.f.es.lazyIni
func (t fileDesc) Messages() pref.MessageDescriptors { return t.f.ms.lazyInit(t, t.f.Messages) }
func (t fileDesc) Extensions() pref.ExtensionDescriptors { return t.f.xs.lazyInit(t, t.f.Extensions) }
func (t fileDesc) Services() pref.ServiceDescriptors { return t.f.ss.lazyInit(t, t.f.Services) }
func (t fileDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t fileDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t fileDesc) ProtoType(pref.FileDescriptor) {}
func (t fileDesc) ProtoInternal(pragma.DoNotImplement) {}
@ -126,7 +126,7 @@ func (t messageDesc) ExtensionRangeOptions(i int) pref.ProtoMessage {
func (t messageDesc) Enums() pref.EnumDescriptors { return t.m.es.lazyInit(t, t.m.Enums) }
func (t messageDesc) Messages() pref.MessageDescriptors { return t.m.ms.lazyInit(t, t.m.Messages) }
func (t messageDesc) Extensions() pref.ExtensionDescriptors { return t.m.xs.lazyInit(t, t.m.Extensions) }
func (t messageDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t messageDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t messageDesc) ProtoType(pref.MessageDescriptor) {}
func (t messageDesc) ProtoInternal(pragma.DoNotImplement) {}
@ -201,7 +201,7 @@ func (t fieldDesc) ContainingMessage() pref.MessageDescriptor {
}
func (t fieldDesc) Enum() pref.EnumDescriptor { return t.f.et.lazyInit(t, &t.f.EnumType) }
func (t fieldDesc) Message() pref.MessageDescriptor { return t.f.mt.lazyInit(t, &t.f.MessageType) }
func (t fieldDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t fieldDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t fieldDesc) ProtoType(pref.FieldDescriptor) {}
func (t fieldDesc) ProtoInternal(pragma.DoNotImplement) {}
@ -288,7 +288,7 @@ func (t oneofDesc) FullName() pref.FullName { return t.o.fullName }
func (t oneofDesc) IsPlaceholder() bool { return false }
func (t oneofDesc) Options() pref.ProtoMessage { return altOptions(t.o.Options, descopts.Oneof) }
func (t oneofDesc) Fields() pref.FieldDescriptors { return t.o.fs.lazyInit(t) }
func (t oneofDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t oneofDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t oneofDesc) ProtoType(pref.OneofDescriptor) {}
func (t oneofDesc) ProtoInternal(pragma.DoNotImplement) {}
@ -336,7 +336,7 @@ func (t extensionDesc) ContainingMessage() pref.MessageDescriptor {
}
func (t extensionDesc) Enum() pref.EnumDescriptor { return t.x.et.lazyInit(t, &t.x.EnumType) }
func (t extensionDesc) Message() pref.MessageDescriptor { return t.x.mt.lazyInit(t, &t.x.MessageType) }
func (t extensionDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t extensionDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t extensionDesc) ProtoType(pref.FieldDescriptor) {}
func (t extensionDesc) ProtoInternal(pragma.DoNotImplement) {}
@ -362,7 +362,7 @@ func (t enumDesc) Options() pref.ProtoMessage { return altOptions(t.e.O
func (t enumDesc) Values() pref.EnumValueDescriptors { return t.e.vs.lazyInit(t, t.e.Values) }
func (t enumDesc) ReservedNames() pref.Names { return (*names)(&t.e.ReservedNames) }
func (t enumDesc) ReservedRanges() pref.EnumRanges { return (*enumRanges)(&t.e.ReservedRanges) }
func (t enumDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t enumDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t enumDesc) ProtoType(pref.EnumDescriptor) {}
func (t enumDesc) ProtoInternal(pragma.DoNotImplement) {}
@ -382,7 +382,7 @@ func (t enumValueDesc) Options() pref.ProtoMessage {
return altOptions(t.v.Options, descopts.EnumValue)
}
func (t enumValueDesc) Number() pref.EnumNumber { return t.v.Number }
func (t enumValueDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t enumValueDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t enumValueDesc) ProtoType(pref.EnumValueDescriptor) {}
func (t enumValueDesc) ProtoInternal(pragma.DoNotImplement) {}
@ -404,7 +404,7 @@ func (t serviceDesc) Options() pref.ProtoMessage {
return altOptions(t.s.Options, descopts.Service)
}
func (t serviceDesc) Methods() pref.MethodDescriptors { return t.s.ms.lazyInit(t, t.s.Methods) }
func (t serviceDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t serviceDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t serviceDesc) ProtoType(pref.ServiceDescriptor) {}
func (t serviceDesc) ProtoInternal(pragma.DoNotImplement) {}
@ -428,7 +428,7 @@ func (t methodDesc) Input() pref.MessageDescriptor { return t.m.mit.lazyIn
func (t methodDesc) Output() pref.MessageDescriptor { return t.m.mot.lazyInit(t, &t.m.OutputType) }
func (t methodDesc) IsStreamingClient() bool { return t.m.IsStreamingClient }
func (t methodDesc) IsStreamingServer() bool { return t.m.IsStreamingServer }
func (t methodDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t methodDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t methodDesc) ProtoType(pref.MethodDescriptor) {}
func (t methodDesc) ProtoInternal(pragma.DoNotImplement) {}

View File

@ -7,9 +7,9 @@ package prototype
import (
"fmt"
descopts "google.golang.org/protobuf/internal/descopts"
pragma "google.golang.org/protobuf/internal/pragma"
pfmt "google.golang.org/protobuf/internal/typefmt"
"google.golang.org/protobuf/internal/descfmt"
"google.golang.org/protobuf/internal/descopts"
"google.golang.org/protobuf/internal/pragma"
pref "google.golang.org/protobuf/reflect/protoreflect"
)
@ -42,7 +42,7 @@ func (t standaloneMessage) ExtensionRangeOptions(i int) pref.ProtoMessage {
func (t standaloneMessage) Enums() pref.EnumDescriptors { return &emptyEnums }
func (t standaloneMessage) Messages() pref.MessageDescriptors { return &emptyMessages }
func (t standaloneMessage) Extensions() pref.ExtensionDescriptors { return &emptyExtensions }
func (t standaloneMessage) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t standaloneMessage) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t standaloneMessage) ProtoType(pref.MessageDescriptor) {}
func (t standaloneMessage) ProtoInternal(pragma.DoNotImplement) {}
@ -61,7 +61,7 @@ func (t standaloneEnum) Options() pref.ProtoMessage {
func (t standaloneEnum) Values() pref.EnumValueDescriptors { return t.e.vals.lazyInit(t, t.e.Values) }
func (t standaloneEnum) ReservedNames() pref.Names { return (*names)(&t.e.ReservedNames) }
func (t standaloneEnum) ReservedRanges() pref.EnumRanges { return (*enumRanges)(&t.e.ReservedRanges) }
func (t standaloneEnum) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t standaloneEnum) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t standaloneEnum) ProtoType(pref.EnumDescriptor) {}
func (t standaloneEnum) ProtoInternal(pragma.DoNotImplement) {}
@ -100,7 +100,7 @@ func (t standaloneExtension) ContainingOneof() pref.OneofDescriptor { return
func (t standaloneExtension) ContainingMessage() pref.MessageDescriptor { return t.x.ExtendedType }
func (t standaloneExtension) Enum() pref.EnumDescriptor { return t.x.EnumType }
func (t standaloneExtension) Message() pref.MessageDescriptor { return t.x.MessageType }
func (t standaloneExtension) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
func (t standaloneExtension) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t standaloneExtension) ProtoType(pref.FieldDescriptor) {}
func (t standaloneExtension) ProtoInternal(pragma.DoNotImplement) {}