Skip to content

Commit

Permalink
proto: inline the implementation of protoimpl.X.ExtensionDescFromType (
Browse files Browse the repository at this point in the history
  • Loading branch information
dsnet committed Mar 13, 2020
1 parent 7bd8073 commit b860323
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions proto/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,10 @@ func ExtensionDescs(m Message) ([]*ExtensionDesc, error) {
extDescs := make(map[protoreflect.FieldNumber]*ExtensionDesc)
mr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
if fd.IsExtension() {
xts := fd.(protoreflect.ExtensionTypeDescriptor)
extDescs[fd.Number()] = protoimpl.X.ExtensionDescFromType(xts.Type())
xt := fd.(protoreflect.ExtensionTypeDescriptor)
if xd, ok := xt.Type().(*ExtensionDesc); ok {
extDescs[fd.Number()] = xd
}
}
return true
})
Expand Down

0 comments on commit b860323

Please sign in to comment.