protogen: use protoreflect descriptors

Change the protogen types wrapping FileDescriptorProto et al. to use
protoreflect descriptors instead.

Change-Id: I99fe83b995a0a6f4fc88f03a6e4b827109a2ec80
Reviewed-on: https://go-review.googlesource.com/133815
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/protogen/names.go b/protogen/names.go
index ea3d057..0c220bc 100644
--- a/protogen/names.go
+++ b/protogen/names.go
@@ -7,6 +7,8 @@
 	"strings"
 	"unicode"
 	"unicode/utf8"
+
+	"google.golang.org/proto/reflect/protoreflect"
 )
 
 // A GoIdent is a Go identifier, consisting of a name and import path.
@@ -17,6 +19,15 @@
 
 func (id GoIdent) String() string { return fmt.Sprintf("%q.%v", id.GoImportPath, id.GoName) }
 
+// newGoIdent returns the Go identifier for a descriptor.
+func newGoIdent(f *File, d protoreflect.Descriptor) GoIdent {
+	name := strings.TrimPrefix(string(d.FullName()), string(f.Desc.Package())+".")
+	return GoIdent{
+		GoName:       camelCase(name),
+		GoImportPath: f.GoImportPath,
+	}
+}
+
 // A GoImportPath is the import path of a Go package. e.g., "google.golang.org/genproto/protobuf".
 type GoImportPath string