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>
This commit is contained in:
Joe Tsai 2019-08-20 22:26:16 -07:00
parent 2cec484ed7
commit 4df99fd526

View File

@ -546,6 +546,8 @@ type EnumValue struct {
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 @@ func newEnumValue(gen *Plugin, f *File, message *Message, enum *Enum, desc proto
return &EnumValue{
Desc: desc,
GoIdent: f.GoImportPath.Ident(name),
Parent: enum,
Location: loc,
Comments: f.comments[newPathKey(loc.Path)],
}