compiler/protogen: add EnumValue.Parent
EnumValues, Fields, Oneofs, and Methods are all declarations that exist
within some parent declaration. The later three have a Parent field.
It seems only consistent that EnumValue have one as well.
Change-Id: I774576565046ede4a96f86ceaa446a39613a39f5
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/191097
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/compiler/protogen/protogen.go b/compiler/protogen/protogen.go
index 32e0e43..0620d3a 100644
--- a/compiler/protogen/protogen.go
+++ b/compiler/protogen/protogen.go
@@ -546,6 +546,8 @@
GoIdent GoIdent // name of the generated Go declaration
+ Parent *Enum // enum in which this value is declared
+
Location Location // location of this enum value
Comments CommentSet // comments associated with this enum value
}
@@ -564,6 +566,7 @@
return &EnumValue{
Desc: desc,
GoIdent: f.GoImportPath.Ident(name),
+ Parent: enum,
Location: loc,
Comments: f.comments[newPathKey(loc.Path)],
}