cmd/protoc-gen-go: used named types for special fields
Using a named fields gives us the flexibility to change the underlying
representation of special fields without needing to regenerate user code.
We add a named type for ExtensionFields, UnknownFields, and SizeCache.
Change-Id: I107cf82899850ea76665310ce79def60f0f7ab97
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/172402
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/runtime/protoimpl/impl.go b/runtime/protoimpl/impl.go
index 3c20296..bbfab27 100644
--- a/runtime/protoimpl/impl.go
+++ b/runtime/protoimpl/impl.go
@@ -41,6 +41,11 @@
MessageType = impl.MessageType
FileBuilder = fileinit.FileBuilder
+ // TODO: Change these to more efficient data structures.
+ ExtensionFields = map[int32]impl.ExtensionFieldV1
+ UnknownFields = []byte
+ SizeCache = int32
+
ExtensionFieldV1 = impl.ExtensionFieldV1
ExtensionFieldsV1 = impl.ExtensionFieldsV1
)