internal/filedesc, internal/filetype: initial commit

The internal/fileinit package is split apart into two packages:
* internal/filedesc constructs descriptors from the raw proto.
It is very similar to the previous internal/fileinit package.
* internal/filetype wraps descriptors with Go type information

Overview:
* The internal/fileinit package will be deleted in a future CL.
It is kept around since the v1 repo currently depends on it.
* The internal/prototype package is deleted. All former usages of it
are now using internal/filedesc instead. Most significantly,
the reflect/protodesc package was almost entirely re-written.
* The internal/impl package drops support for messages that do not
have a Descriptor method (pre-2016). This removes a significant amount
of technical debt.
filedesc.Builder to parse raw descriptors.
* The internal/encoding/defval package now handles enum values by name.

Change-Id: I3957bcc8588a70470fd6c7de1122216b80615ab7
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/182360
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/cmd/protoc-gen-go/testdata/proto3/fields.pb.go b/cmd/protoc-gen-go/testdata/proto3/fields.pb.go
index 81906e9..6023685 100644
--- a/cmd/protoc-gen-go/testdata/proto3/fields.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto3/fields.pb.go
@@ -5,7 +5,7 @@
 
 import (
 	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-	protoregistry "google.golang.org/protobuf/reflect/protoregistry"
+	prototype "google.golang.org/protobuf/reflect/prototype"
 	protoiface "google.golang.org/protobuf/runtime/protoiface"
 	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
 	sync "sync"
@@ -45,7 +45,7 @@
 }
 
 func (FieldTestMessage_Enum) Descriptor() protoreflect.EnumDescriptor {
-	return file_proto3_fields_proto_enumTypes[0].Descriptor()
+	return file_proto3_fields_proto_enumTypes[0].EnumDescriptor
 }
 
 func (x FieldTestMessage_Enum) Number() protoreflect.EnumNumber {
@@ -577,7 +577,7 @@
 	return file_proto3_fields_proto_rawDescData
 }
 
-var file_proto3_fields_proto_enumTypes = make([]protoreflect.EnumType, 1)
+var file_proto3_fields_proto_enumTypes = make([]prototype.Enum, 1)
 var file_proto3_fields_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
 var file_proto3_fields_proto_goTypes = []interface{}{
 	(FieldTestMessage_Enum)(0),       // 0: goproto.protoc.proto3.FieldTestMessage.Enum
@@ -597,6 +597,11 @@
 	4, // goproto.protoc.proto3.FieldTestMessage.map_fixed64_enum:type_name -> goproto.protoc.proto3.FieldTestMessage.MapFixed64EnumEntry
 	5, // goproto.protoc.proto3.FieldTestMessage.MapStringMessageEntry.value:type_name -> goproto.protoc.proto3.FieldTestMessage.Message
 	0, // goproto.protoc.proto3.FieldTestMessage.MapFixed64EnumEntry.value:type_name -> goproto.protoc.proto3.FieldTestMessage.Enum
+	9, // starting offset of method output_type sub-list
+	9, // starting offset of method input_type sub-list
+	9, // starting offset of extension type_name sub-list
+	9, // starting offset of extension extendee sub-list
+	0, // starting offset of field type_name sub-list
 }
 
 func init() { file_proto3_fields_proto_init() }
@@ -604,15 +609,20 @@
 	if File_proto3_fields_proto != nil {
 		return
 	}
-	File_proto3_fields_proto = protoimpl.FileBuilder{
-		RawDescriptor:      file_proto3_fields_proto_rawDesc,
-		GoTypes:            file_proto3_fields_proto_goTypes,
-		DependencyIndexes:  file_proto3_fields_proto_depIdxs,
-		EnumOutputTypes:    file_proto3_fields_proto_enumTypes,
-		MessageOutputTypes: file_proto3_fields_proto_msgTypes,
-		FilesRegistry:      protoregistry.GlobalFiles,
-		TypesRegistry:      protoregistry.GlobalTypes,
-	}.Init()
+	out := protoimpl.TypeBuilder{
+		File: protoimpl.DescBuilder{
+			RawDescriptor: file_proto3_fields_proto_rawDesc,
+			NumEnums:      1,
+			NumMessages:   5,
+			NumExtensions: 0,
+			NumServices:   0,
+		},
+		GoTypes:           file_proto3_fields_proto_goTypes,
+		DependencyIndexes: file_proto3_fields_proto_depIdxs,
+		MessageInfos:      file_proto3_fields_proto_msgTypes,
+	}.Build()
+	File_proto3_fields_proto = out.File
+	file_proto3_fields_proto_enumTypes = out.Enums
 	file_proto3_fields_proto_rawDesc = nil
 	file_proto3_fields_proto_goTypes = nil
 	file_proto3_fields_proto_depIdxs = nil