mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-01 03:14:16 +00:00
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:
parent
2cec484ed7
commit
4df99fd526
@ -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)],
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user