| Index: third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc
|
| diff --git a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc
|
| index ed7448545f26d9a112377c41e7666053ae734f97..532da6b9e104fab09e3b464c9bbdece52b853e3a 100644
|
| --- a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc
|
| +++ b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_message.cc
|
| @@ -105,19 +105,18 @@ void MessageGenerator::Generate(io::Printer* printer) {
|
|
|
| WriteMessageDocComment(printer, descriptor_);
|
| printer->Print(
|
| + "[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\n");
|
| + WriteGeneratedCodeAttributes(printer);
|
| + printer->Print(
|
| vars,
|
| "$access_level$ sealed partial class $class_name$ : pb::IMessage<$class_name$> {\n");
|
| printer->Indent();
|
|
|
| // All static fields and properties
|
| printer->Print(
|
| - vars,
|
| - "private static readonly pb::MessageParser<$class_name$> _parser = new pb::MessageParser<$class_name$>(() => new $class_name$());\n");
|
| -
|
| - WriteGeneratedCodeAttributes(printer);
|
| - printer->Print(
|
| - vars,
|
| - "public static pb::MessageParser<$class_name$> Parser { get { return _parser; } }\n\n");
|
| + vars,
|
| + "private static readonly pb::MessageParser<$class_name$> _parser = new pb::MessageParser<$class_name$>(() => new $class_name$());\n"
|
| + "public static pb::MessageParser<$class_name$> Parser { get { return _parser; } }\n\n");
|
|
|
| // Access the message descriptor via the relevant file descriptor or containing message descriptor.
|
| if (!descriptor_->containing_type()) {
|
| @@ -128,23 +127,18 @@ void MessageGenerator::Generate(io::Printer* printer) {
|
| + ".Descriptor.NestedTypes[" + SimpleItoa(descriptor_->index()) + "]";
|
| }
|
|
|
| - WriteGeneratedCodeAttributes(printer);
|
| printer->Print(
|
| - vars,
|
| - "public static pbr::MessageDescriptor Descriptor {\n"
|
| - " get { return $descriptor_accessor$; }\n"
|
| - "}\n"
|
| - "\n");
|
| - WriteGeneratedCodeAttributes(printer);
|
| - printer->Print(
|
| - vars,
|
| + vars,
|
| + "public static pbr::MessageDescriptor Descriptor {\n"
|
| + " get { return $descriptor_accessor$; }\n"
|
| + "}\n"
|
| + "\n"
|
| "pbr::MessageDescriptor pb::IMessage.Descriptor {\n"
|
| " get { return Descriptor; }\n"
|
| "}\n"
|
| "\n");
|
|
|
| // Parameterless constructor and partial OnConstruction method.
|
| - WriteGeneratedCodeAttributes(printer);
|
| printer->Print(
|
| vars,
|
| "public $class_name$() {\n"
|
| @@ -194,18 +188,12 @@ void MessageGenerator::Generate(io::Printer* printer) {
|
| printer->Print("}\n");
|
| // TODO: Should we put the oneof .proto comments here?
|
| // It's unclear exactly where they should go.
|
| - printer->Print(
|
| - vars,
|
| - "private $property_name$OneofCase $name$Case_ = $property_name$OneofCase.None;\n");
|
| - WriteGeneratedCodeAttributes(printer);
|
| - printer->Print(
|
| - vars,
|
| - "public $property_name$OneofCase $property_name$Case {\n"
|
| - " get { return $name$Case_; }\n"
|
| - "}\n\n");
|
| - WriteGeneratedCodeAttributes(printer);
|
| - printer->Print(
|
| - vars,
|
| + printer->Print(
|
| + vars,
|
| + "private $property_name$OneofCase $name$Case_ = $property_name$OneofCase.None;\n"
|
| + "public $property_name$OneofCase $property_name$Case {\n"
|
| + " get { return $name$Case_; }\n"
|
| + "}\n\n"
|
| "public void Clear$property_name$() {\n"
|
| " $name$Case_ = $property_name$OneofCase.None;\n"
|
| " $name$_ = null;\n"
|
| @@ -222,7 +210,8 @@ void MessageGenerator::Generate(io::Printer* printer) {
|
| printer->Print(
|
| vars,
|
| "#region Nested types\n"
|
| - "/// <summary>Container for nested types declared in the $class_name$ message type.</summary>\n");
|
| + "/// <summary>Container for nested types declared in the $class_name$ message type.</summary>\n"
|
| + "[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\n");
|
| WriteGeneratedCodeAttributes(printer);
|
| printer->Print("public static partial class Types {\n");
|
| printer->Indent();
|
| @@ -266,7 +255,6 @@ bool MessageGenerator::HasNestedGeneratedTypes()
|
|
|
| void MessageGenerator::GenerateCloningCode(io::Printer* printer) {
|
| map<string, string> vars;
|
| - WriteGeneratedCodeAttributes(printer);
|
| vars["class_name"] = class_name();
|
| printer->Print(
|
| vars,
|
| @@ -306,7 +294,6 @@ void MessageGenerator::GenerateCloningCode(io::Printer* printer) {
|
| printer->Outdent();
|
| printer->Print("}\n\n");
|
|
|
| - WriteGeneratedCodeAttributes(printer);
|
| printer->Print(
|
| vars,
|
| "public $class_name$ Clone() {\n"
|
| @@ -322,15 +309,11 @@ void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) {
|
| vars["class_name"] = class_name();
|
|
|
| // Equality
|
| - WriteGeneratedCodeAttributes(printer);
|
| printer->Print(
|
| vars,
|
| "public override bool Equals(object other) {\n"
|
| " return Equals(other as $class_name$);\n"
|
| - "}\n\n");
|
| - WriteGeneratedCodeAttributes(printer);
|
| - printer->Print(
|
| - vars,
|
| + "}\n\n"
|
| "public bool Equals($class_name$ other) {\n"
|
| " if (ReferenceEquals(other, null)) {\n"
|
| " return false;\n"
|
| @@ -355,8 +338,7 @@ void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) {
|
|
|
| // GetHashCode
|
| // Start with a non-zero value to easily distinguish between null and "empty" messages.
|
| - WriteGeneratedCodeAttributes(printer);
|
| - printer->Print(
|
| + printer->Print(
|
| "public override int GetHashCode() {\n"
|
| " int hash = 1;\n");
|
| printer->Indent();
|
| @@ -373,15 +355,13 @@ void MessageGenerator::GenerateFrameworkMethods(io::Printer* printer) {
|
| printer->Outdent();
|
| printer->Print("}\n\n");
|
|
|
| - WriteGeneratedCodeAttributes(printer);
|
| - printer->Print(
|
| + printer->Print(
|
| "public override string ToString() {\n"
|
| " return pb::JsonFormatter.ToDiagnosticString(this);\n"
|
| "}\n\n");
|
| }
|
|
|
| void MessageGenerator::GenerateMessageSerializationMethods(io::Printer* printer) {
|
| - WriteGeneratedCodeAttributes(printer);
|
| printer->Print(
|
| "public void WriteTo(pb::CodedOutputStream output) {\n");
|
| printer->Indent();
|
| @@ -396,10 +376,8 @@ void MessageGenerator::GenerateMessageSerializationMethods(io::Printer* printer)
|
| // TODO(jonskeet): Memoize size of frozen messages?
|
| printer->Outdent();
|
| printer->Print(
|
| - "}\n"
|
| - "\n");
|
| - WriteGeneratedCodeAttributes(printer);
|
| - printer->Print(
|
| + "}\n"
|
| + "\n"
|
| "public int CalculateSize() {\n");
|
| printer->Indent();
|
| printer->Print("int size = 0;\n");
|
| @@ -420,7 +398,6 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) {
|
| map<string, string> vars;
|
| vars["class_name"] = class_name();
|
|
|
| - WriteGeneratedCodeAttributes(printer);
|
| printer->Print(
|
| vars,
|
| "public void MergeFrom($class_name$ other) {\n");
|
| @@ -457,7 +434,6 @@ void MessageGenerator::GenerateMergingMethods(io::Printer* printer) {
|
| }
|
| printer->Outdent();
|
| printer->Print("}\n\n");
|
| - WriteGeneratedCodeAttributes(printer);
|
| printer->Print("public void MergeFrom(pb::CodedInputStream input) {\n");
|
| printer->Indent();
|
| printer->Print(
|
|
|