aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/csharp/csharp_helpers.cc
diff options
context:
space:
mode:
authorJon Skeet <jonskeet@google.com>2015-06-24 17:21:55 +0100
committerJon Skeet <jonskeet@google.com>2015-06-25 09:39:28 +0100
commit0d684d34209f8405106e580af854c45fb7c3f16d (patch)
tree225fcaa27fdc29b3f454b7a4b29b5b843ee711df /src/google/protobuf/compiler/csharp/csharp_helpers.cc
parent0698aa973740d2a666fed8281c84a884a4227aa4 (diff)
downloadprotobuf-0d684d34209f8405106e580af854c45fb7c3f16d.tar.gz
protobuf-0d684d34209f8405106e580af854c45fb7c3f16d.tar.bz2
protobuf-0d684d34209f8405106e580af854c45fb7c3f16d.zip
First pass at map support.
More tests required. Generated code in next commit.
Diffstat (limited to 'src/google/protobuf/compiler/csharp/csharp_helpers.cc')
-rw-r--r--src/google/protobuf/compiler/csharp/csharp_helpers.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.cc b/src/google/protobuf/compiler/csharp/csharp_helpers.cc
index 39a53268..927fea97 100644
--- a/src/google/protobuf/compiler/csharp/csharp_helpers.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_helpers.cc
@@ -46,6 +46,7 @@
#include <google/protobuf/compiler/csharp/csharp_field_base.h>
#include <google/protobuf/compiler/csharp/csharp_enum_field.h>
+#include <google/protobuf/compiler/csharp/csharp_map_field.h>
#include <google/protobuf/compiler/csharp/csharp_message_field.h>
#include <google/protobuf/compiler/csharp/csharp_primitive_field.h>
#include <google/protobuf/compiler/csharp/csharp_repeated_enum_field.h>
@@ -355,7 +356,11 @@ FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor,
case FieldDescriptor::TYPE_GROUP:
case FieldDescriptor::TYPE_MESSAGE:
if (descriptor->is_repeated()) {
- return new RepeatedMessageFieldGenerator(descriptor, fieldOrdinal);
+ if (descriptor->is_map()) {
+ return new MapFieldGenerator(descriptor, fieldOrdinal);
+ } else {
+ return new RepeatedMessageFieldGenerator(descriptor, fieldOrdinal);
+ }
} else {
if (descriptor->containing_oneof()) {
return new MessageOneofFieldGenerator(descriptor, fieldOrdinal);