gRPC migration
Change-Id: I3129ae27d7ee12a23c7046f0d877e8064f2fd7f4
diff --git a/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go b/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go
index b1eeea5..c1866f3 100644
--- a/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go
+++ b/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go
@@ -11,10 +11,9 @@
"google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/errors"
pref "google.golang.org/protobuf/reflect/protoreflect"
- preg "google.golang.org/protobuf/reflect/protoregistry"
)
-// The MessageSet wire format is equivalent to a message defiend as follows,
+// The MessageSet wire format is equivalent to a message defined as follows,
// where each Item defines an extension field with a field number of 'type_id'
// and content of 'message'. MessageSet extensions must be non-repeated message
// fields.
@@ -48,33 +47,17 @@
return ok && xmd.IsMessageSet()
}
-// IsMessageSetExtension reports this field extends a MessageSet.
+// IsMessageSetExtension reports this field properly extends a MessageSet.
func IsMessageSetExtension(fd pref.FieldDescriptor) bool {
- if fd.Name() != ExtensionName {
+ switch {
+ case fd.Name() != ExtensionName:
+ return false
+ case !IsMessageSet(fd.ContainingMessage()):
+ return false
+ case fd.FullName().Parent() != fd.Message().FullName():
return false
}
- if fd.FullName().Parent() != fd.Message().FullName() {
- return false
- }
- return IsMessageSet(fd.ContainingMessage())
-}
-
-// FindMessageSetExtension locates a MessageSet extension field by name.
-// In text and JSON formats, the extension name used is the message itself.
-// The extension field name is derived by appending ExtensionName.
-func FindMessageSetExtension(r preg.ExtensionTypeResolver, s pref.FullName) (pref.ExtensionType, error) {
- name := s.Append(ExtensionName)
- xt, err := r.FindExtensionByName(name)
- if err != nil {
- if err == preg.NotFound {
- return nil, err
- }
- return nil, errors.Wrap(err, "%q", name)
- }
- if !IsMessageSetExtension(xt.TypeDescriptor()) {
- return nil, preg.NotFound
- }
- return xt, nil
+ return true
}
// SizeField returns the size of a MessageSet item field containing an extension