aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Skeet <jonskeet@google.com>2015-07-09 08:24:25 +0100
committerJon Skeet <jonskeet@google.com>2015-07-09 08:24:25 +0100
commit3805b43009d35422bed85c56aaf2d6ce4d007fe5 (patch)
tree448473e7dc7ff9b956bbea84c8e87b4541bb6837
parent3cce11ce1c349ca3674b579acd2ced1db8ad81aa (diff)
parent38d8d3948a2bd83f36d85fb67e1d3c621c5db571 (diff)
downloadprotobuf-3805b43009d35422bed85c56aaf2d6ce4d007fe5.tar.gz
protobuf-3805b43009d35422bed85c56aaf2d6ce4d007fe5.tar.bz2
protobuf-3805b43009d35422bed85c56aaf2d6ce4d007fe5.zip
Merge branch 'csharp-remove-extensions' into csharp-fixup
-rw-r--r--src/google/protobuf/compiler/csharp/csharp_helpers.cc42
-rw-r--r--src/google/protobuf/compiler/csharp/csharp_helpers.h6
2 files changed, 1 insertions, 47 deletions
diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.cc b/src/google/protobuf/compiler/csharp/csharp_helpers.cc
index 156ee328..da6a7633 100644
--- a/src/google/protobuf/compiler/csharp/csharp_helpers.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_helpers.cc
@@ -391,47 +391,7 @@ FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor,
}
}
-bool HasRequiredFields(const Descriptor* descriptor, std::set<const Descriptor*>* already_seen) {
- if (already_seen->find(descriptor) != already_seen->end()) {
- // The type is already in cache. This means that either:
- // a. The type has no required fields.
- // b. We are in the midst of checking if the type has required fields,
- // somewhere up the stack. In this case, we know that if the type
- // has any required fields, they'll be found when we return to it,
- // and the whole call to HasRequiredFields() will return true.
- // Therefore, we don't have to check if this type has required fields
- // here.
- return false;
- }
- already_seen->insert(descriptor);
-
- // If the type has extensions, an extension with message type could contain
- // required fields, so we have to be conservative and assume such an
- // extension exists.
- if (descriptor->extension_count() > 0) {
- return true;
- }
-
- for (int i = 0; i < descriptor->field_count(); i++) {
- const FieldDescriptor* field = descriptor->field(i);
- if (field->is_required()) {
- return true;
- }
- if (GetCSharpType(field->type()) == CSHARPTYPE_MESSAGE) {
- if (HasRequiredFields(field->message_type(), already_seen)) {
- return true;
- }
- }
- }
- return false;
-}
-
-bool HasRequiredFields(const Descriptor* descriptor) {
- std::set<const Descriptor*> already_seen;
- return HasRequiredFields(descriptor, &already_seen);
-}
-
-} // namespace java
+} // namespace csharp
} // namespace compiler
} // namespace protobuf
} // namespace google
diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.h b/src/google/protobuf/compiler/csharp/csharp_helpers.h
index d2ee8fbe..a8c1fa18 100644
--- a/src/google/protobuf/compiler/csharp/csharp_helpers.h
+++ b/src/google/protobuf/compiler/csharp/csharp_helpers.h
@@ -101,12 +101,6 @@ uint FixedMakeTag(const FieldDescriptor* descriptor);
FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal);
-bool HasRequiredFields(const Descriptor* descriptor);
-
-inline bool SupportFieldPresence(const FileDescriptor* file) {
- return file->syntax() != FileDescriptor::SYNTAX_PROTO3;
-}
-
} // namespace csharp
} // namespace compiler
} // namespace protobuf