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/internal_gengo/main.go b/cmd/protoc-gen-go/internal_gengo/main.go
index a17af06..b3556a4 100644
--- a/cmd/protoc-gen-go/internal_gengo/main.go
+++ b/cmd/protoc-gen-go/internal_gengo/main.go
@@ -44,6 +44,7 @@
 	protoimplPackage     = protogen.GoImportPath("google.golang.org/protobuf/runtime/protoimpl")
 	protoreflectPackage  = protogen.GoImportPath("google.golang.org/protobuf/reflect/protoreflect")
 	protoregistryPackage = protogen.GoImportPath("google.golang.org/protobuf/reflect/protoregistry")
+	prototypePackage     = protogen.GoImportPath("google.golang.org/protobuf/reflect/prototype")
 )
 
 type fileInfo struct {
@@ -65,7 +66,7 @@
 	}
 
 	// Collect all enums, messages, and extensions in "flattened ordering".
-	// See fileinit.FileBuilder.
+	// See filetype.TypeBuilder.
 	f.allEnums = append(f.allEnums, f.Enums...)
 	f.allMessages = append(f.allMessages, f.Messages...)
 	f.allExtensions = append(f.allExtensions, f.Extensions...)
@@ -625,7 +626,7 @@
 		return
 	}
 
-	g.P("var ", extDecsVarName(f), " = []", protoifacePackage.Ident("ExtensionDescV1"), "{")
+	g.P("var ", extDescsVarName(f), " = []", protoifacePackage.Ident("ExtensionDescV1"), "{")
 	for _, extension := range f.allExtensions {
 		// Special case for proto2 message sets: If this extension is extending
 		// proto2.bridge.MessageSet, and its final name component is "message_set_extension",
@@ -668,7 +669,7 @@
 		}
 		fieldName := string(ed.Name())
 		g.P("// extend ", targetName, " { ", ed.Cardinality().String(), " ", typeName, " ", fieldName, " = ", ed.Number(), "; }")
-		g.P(extensionVar(f.File, extension), " = &", extDecsVarName(f), "[", i, "]")
+		g.P(extensionVar(f.File, extension), " = &", extDescsVarName(f), "[", i, "]")
 		g.P()
 	}
 	g.P(")")