File tree Expand file tree Collapse file tree 4 files changed +13
-2
lines changed Expand file tree Collapse file tree 4 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -2035,10 +2035,18 @@ CheckedError Parser::ParseProtoDecl() {
2035
2035
2036
2036
// Temp: remove any duplicates, as .fbs files can't handle them.
2037
2037
for (auto it = v.begin (); it != v.end ();) {
2038
- if (it != v.begin () && it[0 ]->value == it[-1 ]->value )
2038
+ if (it != v.begin () && it[0 ]->value == it[-1 ]->value ) {
2039
+ auto ref = it[-1 ];
2040
+ auto ev = it[0 ];
2041
+ for (auto dit = enum_def->vals .dict .begin ();
2042
+ dit != enum_def->vals .dict .end (); ++dit) {
2043
+ if (dit->second == ev) dit->second = ref; // reassign
2044
+ }
2045
+ delete ev; // delete enum value
2039
2046
it = v.erase (it);
2040
- else
2047
+ } else {
2041
2048
++it;
2049
+ }
2042
2050
}
2043
2051
} else if (IsIdent (" syntax" )) { // Skip these.
2044
2052
NEXT ();
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ namespace proto.test;
4
4
5
5
/// Enum doc comment.
6
6
enum ProtoEnum : int {
7
+ NUL = 0,
7
8
FOO = 1,
8
9
/// Enum 2nd value doc comment misaligned.
9
10
BAR = 5,
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ package proto.test;
8
8
/// Enum doc comment.
9
9
enum ProtoEnum {
10
10
option allow_alias = true ;
11
+ NUL = 0 ;
11
12
FOO = 1 ;
12
13
/// Enum 2nd value doc comment misaligned.
13
14
BAR = 5 ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ namespace proto.test;
4
4
5
5
/// Enum doc comment.
6
6
enum ProtoEnum : int {
7
+ NUL = 0,
7
8
FOO = 1,
8
9
/// Enum 2nd value doc comment misaligned.
9
10
BAR = 5,
You can’t perform that action at this time.
0 commit comments