aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc
diff options
context:
space:
mode:
authorJan Tattermusch <jtattermusch@google.com>2015-04-13 12:40:48 -0700
committerJan Tattermusch <jtattermusch@google.com>2015-04-13 12:40:48 -0700
commit44664bb705fc704ac3cc5a745d200145a4897ed2 (patch)
tree6c09d5ea86bdc8cddab959ec73af43dabb871b20 /src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc
parentb52cf04b3c4237bc8d2eee865d5a8f981a30d6bd (diff)
downloadprotobuf-44664bb705fc704ac3cc5a745d200145a4897ed2.tar.gz
protobuf-44664bb705fc704ac3cc5a745d200145a4897ed2.tar.bz2
protobuf-44664bb705fc704ac3cc5a745d200145a4897ed2.zip
updated C# codegen to use restricted set of csharp options from descriptor.proto
Diffstat (limited to 'src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc')
-rw-r--r--src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc b/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc
index ead6c1a9..358cfa4f 100644
--- a/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc
+++ b/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc
@@ -86,17 +86,14 @@ void UmbrellaClassGenerator::Generate(Writer* writer) {
} else {
WriteLiteExtensions(writer);
}
- // The class declaration either gets closed before or after the children are written.
- if (!file_->options().csharp_nest_classes()) {
+ // Close the class declaration.
+ writer->Outdent();
+ writer->WriteLine("}");
+
+ // Close the namespace around the umbrella class if defined
+ if (!umbrellaNamespace_.empty()) {
writer->Outdent();
writer->WriteLine("}");
-
- // Close the namespace around the umbrella class if defined
- if (!file_->options().csharp_nest_classes()
- && !umbrellaNamespace_.empty()) {
- writer->Outdent();
- writer->WriteLine("}");
- }
}
// write children: Enums
@@ -121,12 +118,8 @@ void UmbrellaClassGenerator::Generate(Writer* writer) {
writer->WriteLine();
}
- // TODO(jtattermusch): add support for generating services.
- //WriteChildren(writer, "Services", Descriptor.Services);
- if (file_->options().csharp_nest_classes()) {
- writer->Outdent();
- writer->WriteLine("}");
- }
+ // TODO(jtattermusch): add insertion point for services.
+
if (!namespace_.empty()) {
writer->Outdent();
writer->WriteLine("}");
@@ -155,16 +148,12 @@ void UmbrellaClassGenerator::WriteIntroduction(Writer* writer) {
}
// Add the namespace around the umbrella class if defined
- if (!file_->options().csharp_nest_classes() && !umbrellaNamespace_.empty()) {
+ if (!umbrellaNamespace_.empty()) {
writer->WriteLine("namespace $0$ {", umbrellaNamespace_);
writer->Indent();
writer->WriteLine();
}
- if (file_->options().csharp_code_contracts()) {
- writer->WriteLine(
- "[global::System.Diagnostics.Contracts.ContractVerificationAttribute(false)]");
- }
writer->WriteLine(
"[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
WriteGeneratedCodeAttributes(writer);