aboutsummaryrefslogtreecommitdiff
path: root/src/ProtoGen/MessageGenerator.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ProtoGen/MessageGenerator.cs')
-rw-r--r--src/ProtoGen/MessageGenerator.cs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ProtoGen/MessageGenerator.cs b/src/ProtoGen/MessageGenerator.cs
index 13c6fad0..65a2d896 100644
--- a/src/ProtoGen/MessageGenerator.cs
+++ b/src/ProtoGen/MessageGenerator.cs
@@ -653,7 +653,12 @@ namespace Google.ProtocolBuffers.ProtoGen
writer.WriteLine("}");
foreach (FieldDescriptor field in sortedFields)
{
- uint tag = WireFormat.MakeTag(field);
+ WireFormat.WireType wt = WireFormat.GetWireType(field.FieldType);
+ uint tag = WireFormat.MakeTag(field.FieldNumber, wt);
+
+ if(field.IsRepeated && (wt == WireFormat.WireType.Varint || wt == WireFormat.WireType.Fixed32 || wt == WireFormat.WireType.Fixed64))
+ writer.WriteLine("case {0}:", WireFormat.MakeTag(field.FieldNumber, WireFormat.WireType.LengthDelimited));
+
writer.WriteLine("case {0}: {{", tag);
writer.Indent();
SourceGenerators.CreateFieldGenerator(field).GenerateParsingCode(writer);