From b860323f09d003f27661946a05cca5329f3c7950 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Fri, 13 Mar 2020 16:19:45 -0700 Subject: [PATCH] proto: inline the implementation of protoimpl.X.ExtensionDescFromType (#1056) --- proto/extensions.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/proto/extensions.go b/proto/extensions.go index d78d25830c..65e1295154 100644 --- a/proto/extensions.go +++ b/proto/extensions.go @@ -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 })