aboutsummaryrefslogtreecommitdiff
path: root/src/ProtoGen/MessageGenerator.cs
diff options
context:
space:
mode:
authorcsharptest <roger@csharptest.net>2011-06-04 12:52:57 -0500
committerrogerk <devnull@localhost>2011-06-04 12:52:57 -0500
commit6da3170a953b38d2e454a3035ebc24ed1cd4803a (patch)
tree696207ccde20a4ff20c1ef0c0f603ca8c86ad440 /src/ProtoGen/MessageGenerator.cs
parent17699c21f98bda5ca039be3f5d43c9b0aa462aea (diff)
downloadprotobuf-6da3170a953b38d2e454a3035ebc24ed1cd4803a.tar.gz
protobuf-6da3170a953b38d2e454a3035ebc24ed1cd4803a.tar.bz2
protobuf-6da3170a953b38d2e454a3035ebc24ed1cd4803a.zip
Packed and Unpacked parsing allow for all repeated, per 2.3
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);