Commit dbf77c65 authored by Sydney Acksman's avatar Sydney Acksman Committed by Bo Yang

Refactor how group endings are detected in generated C# code (#5686)

* Modify how end tags are encounted in merge code (compiler)

* Modify how end tags are encounted in merge code (generated)

* Modify how end tags are encounted in merge code (library)

* Regenerate generated code through generate_descriptor_proto.sh
parent a1332ae3
......@@ -260,9 +260,7 @@ namespace Google.Protobuf.Examples.AddressBook {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......@@ -442,9 +440,7 @@ namespace Google.Protobuf.Examples.AddressBook {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Number = input.ReadString();
......@@ -577,9 +573,7 @@ namespace Google.Protobuf.Examples.AddressBook {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
people_.AddEntriesFrom(input, _repeated_people_codec);
......
......@@ -216,9 +216,7 @@ namespace Conformance {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
failure_.AddEntriesFrom(input, _repeated_failure_codec);
......@@ -581,9 +579,7 @@ namespace Conformance {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
ProtobufPayload = input.ReadBytes();
......@@ -1001,9 +997,7 @@ namespace Conformance {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
ParseError = input.ReadString();
......@@ -1166,9 +1160,7 @@ namespace Conformance {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
UseJspbArrayAnyFormat = input.ReadBool();
......
......@@ -541,9 +541,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec);
......@@ -739,9 +737,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
if (testMap_ == null) {
......@@ -865,9 +861,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
mapInt32Message_.AddEntriesFrom(input, _map_mapInt32Message_codec);
......@@ -1007,9 +1001,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
map1_.AddEntriesFrom(input, _map_map1_codec);
......@@ -1358,9 +1350,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec);
......@@ -1541,9 +1531,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
type_.AddEntriesFrom(input, _map_type_codec);
......@@ -1678,9 +1666,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
entry_.AddEntriesFrom(input, _map_entry_codec);
......
......@@ -2895,9 +2895,7 @@ namespace ProtobufTestMessages.Proto3 {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
OptionalInt32 = input.ReadInt32();
......@@ -3625,9 +3623,7 @@ namespace ProtobufTestMessages.Proto3 {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
A = input.ReadInt32();
......@@ -3768,9 +3764,7 @@ namespace ProtobufTestMessages.Proto3 {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
C = input.ReadInt32();
......
......@@ -352,9 +352,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Field1 = input.ReadString();
......@@ -480,9 +478,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -583,9 +579,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -686,9 +680,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -789,9 +781,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -892,9 +882,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -1008,9 +996,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -1111,9 +1097,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -1214,9 +1198,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -1317,9 +1299,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -1420,9 +1400,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -1523,9 +1501,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -1714,9 +1690,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Foo = input.ReadInt32();
......@@ -1928,9 +1902,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
if (bar_ == null) {
......@@ -2079,9 +2051,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Waldo = input.ReadInt32();
......@@ -2215,9 +2185,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Qux = input.ReadInt32();
......@@ -2325,9 +2293,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -2509,9 +2475,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
I = input.ReadInt32();
......@@ -2651,9 +2615,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Fieldname = input.ReadInt32();
......@@ -2761,9 +2723,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -2895,9 +2855,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
NestedField = input.ReadInt32();
......
......@@ -167,9 +167,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
D = input.ReadInt32();
......
......@@ -155,9 +155,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
E = input.ReadInt32();
......
......@@ -181,9 +181,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -286,9 +284,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -391,9 +387,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -560,9 +554,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Value = (global::UnitTest.Issues.TestProtos.NegativeEnum) input.ReadEnum();
......@@ -677,9 +669,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -909,9 +899,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
PrimitiveValue = input.ReadInt32();
......@@ -1068,9 +1056,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Item = input.ReadInt32();
......@@ -1223,9 +1209,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Types_ = input.ReadInt32();
......@@ -1339,9 +1323,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......@@ -1665,9 +1647,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
PlainString = input.ReadString();
......@@ -1867,9 +1847,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......@@ -2069,9 +2047,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Text = input.ReadString();
......@@ -2235,9 +2211,7 @@ namespace UnitTest.Issues.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
X = input.ReadInt32();
......
......@@ -788,9 +788,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
if (anyField_ == null) {
......@@ -1318,9 +1316,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
anyField_.AddEntriesFrom(input, _repeated_anyField_codec);
......@@ -2031,9 +2027,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
global::Google.Protobuf.WellKnownTypes.Any subBuilder = new global::Google.Protobuf.WellKnownTypes.Any();
......@@ -2544,9 +2538,7 @@ namespace Google.Protobuf.TestProtos {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
anyField_.AddEntriesFrom(input, _map_anyField_codec);
......
......@@ -302,9 +302,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
file_.AddEntriesFrom(input, _repeated_file_codec);
......@@ -735,9 +733,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......@@ -1102,9 +1098,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......@@ -1363,9 +1357,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Start = input.ReadInt32();
......@@ -1568,9 +1560,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Start = input.ReadInt32();
......@@ -1703,9 +1693,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 7994: {
uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec);
......@@ -2212,9 +2200,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......@@ -2501,9 +2487,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......@@ -2748,9 +2732,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......@@ -2966,9 +2948,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Start = input.ReadInt32();
......@@ -3197,9 +3177,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......@@ -3407,9 +3385,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......@@ -3759,9 +3735,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......@@ -6949,9 +6923,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 18: {
name_.AddEntriesFrom(input, _repeated_name_codec);
......@@ -7164,9 +7136,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
NamePart_ = input.ReadString();
......@@ -7345,9 +7315,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
location_.AddEntriesFrom(input, _repeated_location_codec);
......@@ -7655,9 +7623,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10:
case 8: {
......@@ -7810,9 +7776,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
annotation_.AddEntriesFrom(input, _repeated_annotation_codec);
......@@ -8063,9 +8027,7 @@ namespace Google.Protobuf.Reflection {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10:
case 8: {
......
......@@ -260,29 +260,6 @@ namespace Google.Protobuf
}
return unknownFields;
}
/// <summary>
/// Create a new UnknownFieldSet if unknownFields is null.
/// Parse a single field from <paramref name="input"/> and merge it
/// into unknownFields. If <paramref name="input"/> is configured to discard unknown fields,
/// <paramref name="unknownFields"/> will be returned as-is and the field will be skipped.
/// </summary>
/// <param name="unknownFields">The UnknownFieldSet which need to be merged</param>
/// <param name="input">The coded input stream containing the field</param>
/// <returns>The merged UnknownFieldSet</returns>
public static bool MergeFieldFrom(ref UnknownFieldSet unknownFields, CodedInputStream input)
{
if (input.DiscardUnknownFields)
{
input.SkipLastField();
return true;
}
if (unknownFields == null)
{
unknownFields = new UnknownFieldSet();
}
return unknownFields.MergeFieldFrom(input);
}
/// <summary>
/// Merges the fields from <paramref name="other"/> into this set.
......
......@@ -292,9 +292,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
TypeUrl = input.ReadString();
......
......@@ -345,9 +345,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......@@ -663,9 +661,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......@@ -929,9 +925,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......
......@@ -254,9 +254,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Seconds = input.ReadInt64();
......
......@@ -143,9 +143,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
......
......@@ -352,9 +352,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
paths_.AddEntriesFrom(input, _repeated_paths_codec);
......
......@@ -165,9 +165,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
FileName = input.ReadString();
......
......@@ -189,9 +189,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
fields_.AddEntriesFrom(input, _map_fields_codec);
......@@ -515,9 +513,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
kind_ = input.ReadEnum();
......@@ -677,9 +673,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
values_.AddEntriesFrom(input, _repeated_values_codec);
......
......@@ -273,9 +273,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Seconds = input.ReadInt64();
......
......@@ -328,9 +328,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......@@ -725,9 +723,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Kind = (global::Google.Protobuf.WellKnownTypes.Field.Types.Kind) input.ReadEnum();
......@@ -1104,9 +1100,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......@@ -1306,9 +1300,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......@@ -1488,9 +1480,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
......
......@@ -177,9 +177,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 9: {
Value = input.ReadDouble();
......@@ -316,9 +314,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 13: {
Value = input.ReadFloat();
......@@ -455,9 +451,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Value = input.ReadInt64();
......@@ -594,9 +588,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Value = input.ReadUInt64();
......@@ -733,9 +725,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Value = input.ReadInt32();
......@@ -872,9 +862,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Value = input.ReadUInt32();
......@@ -1011,9 +999,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Value = input.ReadBool();
......@@ -1150,9 +1136,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Value = input.ReadString();
......@@ -1289,9 +1273,7 @@ namespace Google.Protobuf.WellKnownTypes {
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Value = input.ReadBytes();
......
......@@ -278,6 +278,19 @@ std::string GetEnumValueName(const std::string& enum_name, const std::string& en
return result;
}
uint GetGroupEndTag(const Descriptor* descriptor) {
const Descriptor* containing_type = descriptor->containing_type();
if (containing_type == NULL) {
return 0;
}
const FieldDescriptor* field = containing_type->FindFieldByName(descriptor->name());
if (field != NULL && field->type() == FieldDescriptor::Type::TYPE_GROUP) {
return internal::WireFormatLite::MakeTag(field->number(), internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED);
} else {
return 0;
}
}
std::string ToCSharpName(const std::string& name, const FileDescriptor* file) {
std::string result = GetFileNamespace(file);
if (result != "") {
......
......@@ -118,6 +118,9 @@ inline bool IsMapEntryMessage(const Descriptor* descriptor) {
return descriptor->options().map_entry();
}
// Checks if this descriptor is for a group and gets its end tag or 0 if it's not a group
uint GetGroupEndTag(const Descriptor* descriptor);
// Determines whether we're generating code for the proto representation of
// descriptors etc, for use in the runtime. This is the only type which is
// allowed to use proto2 syntax, and it generates internal classes.
......
......@@ -63,7 +63,8 @@ MessageGenerator::MessageGenerator(const Descriptor* descriptor,
const Options* options)
: SourceGeneratorBase(descriptor->file(), options),
descriptor_(descriptor),
has_bit_field_count_(0) {
has_bit_field_count_(0),
end_tag_(GetGroupEndTag(descriptor)) {
// fields by number
for (int i = 0; i < descriptor_->field_count(); i++) {
fields_by_number_.push_back(descriptor_->field(i));
......@@ -539,10 +540,14 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) {
} else {
printer->Print(
"default:\n"
" if (!pb::UnknownFieldSet.MergeFieldFrom(ref _unknownFields, input)) {\n"
" return;\n"
" }\n"
" _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);\n"
" break;\n");
if (end_tag_ != 0) {
printer->Print(
"$end_tag$:\n"
" return;\n",
"end_tag", SimpleItoa(end_tag_));
}
}
for (int i = 0; i < fields_by_number().size(); i++) {
const FieldDescriptor* field = fields_by_number()[i];
......
......@@ -59,6 +59,7 @@ class MessageGenerator : public SourceGeneratorBase {
const Descriptor* descriptor_;
std::vector<const FieldDescriptor*> fields_by_number_;
int has_bit_field_count_;
uint end_tag_;
void GenerateMessageSerializationMethods(io::Printer* printer);
void GenerateMergingMethods(io::Printer* printer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment