Commit 8c2b8d11 authored by csharptest's avatar csharptest Committed by rogerk

merged issue-22

parents 7f20cc90 3b625064
This diff is collapsed.
......@@ -72,12 +72,14 @@ namespace Google.ProtocolBuffers.ProtoGen
writer.WriteLine("}");
AddPublicMemberAttributes(writer);
writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.has{0} = true;", PropertyName);
writer.WriteLine(" result.{0}_ = value;", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Clear{0}() {{", PropertyName);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.has{0} = false;", PropertyName);
writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue);
writer.WriteLine(" return this;");
......
......@@ -73,6 +73,7 @@ namespace Google.ProtocolBuffers.ProtoGen
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName);
AddNullCheck(writer);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.has{0} = true;", PropertyName);
writer.WriteLine(" result.{0}_ = value;", Name);
writer.WriteLine(" return this;");
......@@ -80,6 +81,7 @@ namespace Google.ProtocolBuffers.ProtoGen
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Set{0}({1}.Builder builderForValue) {{", PropertyName, TypeName);
AddNullCheck(writer, "builderForValue");
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.has{0} = true;", PropertyName);
writer.WriteLine(" result.{0}_ = builderForValue.Build();", Name);
writer.WriteLine(" return this;");
......@@ -87,6 +89,7 @@ namespace Google.ProtocolBuffers.ProtoGen
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Merge{0}({1} value) {{", PropertyName, TypeName);
AddNullCheck(writer);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" if (result.has{0} &&", PropertyName);
writer.WriteLine(" result.{0}_ != {1}) {{", Name, DefaultValue);
writer.WriteLine(" result.{0}_ = {1}.CreateBuilder(result.{0}_).MergeFrom(value).BuildPartial();", Name,
......@@ -99,6 +102,7 @@ namespace Google.ProtocolBuffers.ProtoGen
writer.WriteLine("}");
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Clear{0}() {{", PropertyName);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.has{0} = false;", PropertyName);
writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue);
writer.WriteLine(" return this;");
......
......@@ -556,7 +556,7 @@ namespace Google.ProtocolBuffers.ProtoGen
writer.WriteLine("public override Builder ToBuilder() { return CreateBuilder(this); }");
writer.WriteLine("public override Builder CreateBuilderForType() { return new Builder(); }");
writer.WriteLine("public static Builder CreateBuilder({0} prototype) {{", ClassName);
writer.WriteLine(" return (Builder) new Builder().MergeFrom(prototype);");
writer.WriteLine(" return new Builder(prototype);");
writer.WriteLine("}");
writer.WriteLine();
if (Descriptor.File.CSharpOptions.AddSerializable)
......@@ -591,21 +591,52 @@ namespace Google.ProtocolBuffers.ProtoGen
private void GenerateCommonBuilderMethods(TextGenerator writer)
{
writer.WriteLine("public Builder() {{}}", ClassAccessLevel);
//default constructor
writer.WriteLine("public Builder() {");
//Durring static initialization of message, DefaultInstance is expected to return null.
writer.WriteLine(" result = DefaultInstance ?? new {0}();", ClassName);
writer.WriteLine(" builderIsReadOnly = result == DefaultInstance;");
writer.WriteLine("}");
//clone constructor
writer.WriteLine("internal Builder({0} cloneFrom) {{", ClassName);
writer.WriteLine(" result = cloneFrom;");
writer.WriteLine(" builderIsReadOnly = true;");
writer.WriteLine("}");
writer.WriteLine();
writer.WriteLine("{0} result = new {0}();", ClassName);
writer.WriteLine("bool builderIsReadOnly;");
writer.WriteLine("{0} result;", ClassName);
writer.WriteLine();
writer.WriteLine("private {0} PrepareBuilder() {{", ClassName);
writer.WriteLine(" if (builderIsReadOnly) {");
writer.WriteLine(" {0} original = result;", ClassName);
writer.WriteLine(" result = new {0}();", ClassName);
writer.WriteLine(" builderIsReadOnly = false;");
writer.WriteLine(" MergeFrom(original);");
writer.WriteLine(" }");
writer.WriteLine(" return result;");
writer.WriteLine("}");
writer.WriteLine();
writer.WriteLine("public override bool IsInitialized {");
writer.WriteLine(" get { return result.IsInitialized; }");
writer.WriteLine("}");
writer.WriteLine();
writer.WriteLine("protected override {0} MessageBeingBuilt {{", ClassName);
writer.WriteLine(" get { return result; }");
writer.WriteLine(" get { return PrepareBuilder(); }");
writer.WriteLine("}");
writer.WriteLine();
//Not actually expecting that DefaultInstance would ever be null here; however, we will ensure it does not break
writer.WriteLine("public override Builder Clear() {");
writer.WriteLine(" result = new {0}();", ClassName);
writer.WriteLine(" result = DefaultInstance ?? new {0}();", ClassName);
writer.WriteLine(" builderIsReadOnly = true;");
writer.WriteLine(" return this;");
writer.WriteLine("}");
writer.WriteLine();
writer.WriteLine("public override Builder Clone() {");
writer.WriteLine(" if (builderIsReadOnly) {");
writer.WriteLine(" return new Builder(result);");
writer.WriteLine(" } else {");
writer.WriteLine(" return new Builder().MergeFrom(result);");
writer.WriteLine(" }");
writer.WriteLine("}");
writer.WriteLine();
if (!UseLiteRuntime)
......@@ -622,17 +653,15 @@ namespace Google.ProtocolBuffers.ProtoGen
writer.WriteLine("public override {0} BuildPartial() {{", ClassName);
writer.Indent();
writer.WriteLine("if (result == null) {");
writer.WriteLine(
" throw new global::System.InvalidOperationException(\"build() has already been called on this Builder\");");
writer.WriteLine("if (builderIsReadOnly) {");
writer.WriteLine(" return result;");
writer.WriteLine("}");
foreach (FieldDescriptor field in Descriptor.Fields)
{
CreateFieldGenerator(field).GenerateBuildingCode(writer);
}
writer.WriteLine("{0} returnMe = result;", ClassName);
writer.WriteLine("result = null;");
writer.WriteLine("return returnMe;");
writer.WriteLine("builderIsReadOnly = true;");
writer.WriteLine("return result;");
writer.Outdent();
writer.WriteLine("}");
writer.WriteLine();
......@@ -653,6 +682,7 @@ namespace Google.ProtocolBuffers.ProtoGen
// fields are set so we can skip the merge.
writer.Indent();
writer.WriteLine("if (other == {0}.DefaultInstance) return this;", FullClassName);
writer.WriteLine("PrepareBuilder();");
foreach (FieldDescriptor field in Descriptor.Fields)
{
CreateFieldGenerator(field).GenerateMergingCode(writer);
......@@ -685,6 +715,7 @@ namespace Google.ProtocolBuffers.ProtoGen
writer.WriteLine(
"public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {");
writer.Indent();
writer.WriteLine("PrepareBuilder();");
if (!UseLiteRuntime)
{
writer.WriteLine("pb::UnknownFieldSet.Builder unknownFields = null;");
......
......@@ -74,12 +74,14 @@ namespace Google.ProtocolBuffers.ProtoGen
AddPublicMemberAttributes(writer);
writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName);
AddNullCheck(writer);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.has{0} = true;", PropertyName);
writer.WriteLine(" result.{0}_ = value;", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Clear{0}() {{", PropertyName);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.has{0} = false;", PropertyName);
writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue);
writer.WriteLine(" return this;");
......
......@@ -75,7 +75,7 @@ namespace Google.ProtocolBuffers.ProtoGen
// We return it via IPopsicleList so that collection initializers work more pleasantly.
AddDeprecatedFlag(writer);
writer.WriteLine("public pbc::IPopsicleList<{0}> {1}List {{", TypeName, PropertyName);
writer.WriteLine(" get {{ return result.{0}_; }}", Name);
writer.WriteLine(" get {{ return PrepareBuilder().{0}_; }}", Name);
writer.WriteLine("}");
AddDeprecatedFlag(writer);
writer.WriteLine("public int {0}Count {{", PropertyName);
......@@ -87,21 +87,25 @@ namespace Google.ProtocolBuffers.ProtoGen
writer.WriteLine("}");
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_[index] = value;", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName);
writer.WriteLine(" return this;");
writer.WriteLine("}");
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_.Add(values);", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Clear{0}() {{", PropertyName);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_.Clear();", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
......
......@@ -71,7 +71,7 @@ namespace Google.ProtocolBuffers.ProtoGen
// We return it via IPopsicleList so that collection initializers work more pleasantly.
AddDeprecatedFlag(writer);
writer.WriteLine("public pbc::IPopsicleList<{0}> {1}List {{", TypeName, PropertyName);
writer.WriteLine(" get {{ return result.{0}_; }}", Name);
writer.WriteLine(" get {{ return PrepareBuilder().{0}_; }}", Name);
writer.WriteLine("}");
AddDeprecatedFlag(writer);
writer.WriteLine("public int {0}Count {{", PropertyName);
......@@ -84,6 +84,7 @@ namespace Google.ProtocolBuffers.ProtoGen
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName);
AddNullCheck(writer);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_[index] = value;", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
......@@ -91,12 +92,14 @@ namespace Google.ProtocolBuffers.ProtoGen
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Set{0}(int index, {1}.Builder builderForValue) {{", PropertyName, TypeName);
AddNullCheck(writer, "builderForValue");
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_[index] = builderForValue.Build();", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName);
AddNullCheck(writer);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName);
writer.WriteLine(" return this;");
writer.WriteLine("}");
......@@ -104,16 +107,19 @@ namespace Google.ProtocolBuffers.ProtoGen
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Add{0}({1}.Builder builderForValue) {{", PropertyName, TypeName);
AddNullCheck(writer, "builderForValue");
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_.Add(builderForValue.Build());", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_.Add(values);", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Clear{0}() {{", PropertyName);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_.Clear();", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
......
......@@ -75,7 +75,7 @@ namespace Google.ProtocolBuffers.ProtoGen
// We return it via IPopsicleList so that collection initializers work more pleasantly.
AddPublicMemberAttributes(writer);
writer.WriteLine("public pbc::IPopsicleList<{0}> {1}List {{", TypeName, PropertyName);
writer.WriteLine(" get {{ return result.{0}_; }}", Name);
writer.WriteLine(" get {{ return PrepareBuilder().{0}_; }}", Name);
writer.WriteLine("}");
AddDeprecatedFlag(writer);
writer.WriteLine("public int {0}Count {{", PropertyName);
......@@ -88,22 +88,26 @@ namespace Google.ProtocolBuffers.ProtoGen
AddPublicMemberAttributes(writer);
writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName);
AddNullCheck(writer);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_[index] = value;", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
AddPublicMemberAttributes(writer);
writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName);
AddNullCheck(writer);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName);
writer.WriteLine(" return this;");
writer.WriteLine("}");
AddPublicMemberAttributes(writer);
writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_.Add(values);", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
AddDeprecatedFlag(writer);
writer.WriteLine("public Builder Clear{0}() {{", PropertyName);
writer.WriteLine(" PrepareBuilder();");
writer.WriteLine(" result.{0}_.Clear();", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
......
......@@ -111,22 +111,6 @@ namespace Google.ProtocolBuffers
}
}
[Test]
public void DoubleBuildError()
{
TestAllTypes.Builder builder = new TestAllTypes.Builder();
builder.Build();
try
{
builder.Build();
Assert.Fail("Should have thrown exception.");
}
catch (InvalidOperationException)
{
// Success.
}
}
[Test]
public void DefaultInstance()
{
......
......@@ -103,6 +103,7 @@
<Compile Include="NameHelpersTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ReflectionTester.cs" />
<Compile Include="ReusableBuilderTest.cs" />
<Compile Include="SerializableTest.cs" />
<Compile Include="ServiceTest.cs" />
<Compile Include="TestCornerCases.cs" />
......
using System;
using System.Collections.Generic;
using System.Text;
using Google.ProtocolBuffers.Collections;
using NUnit.Framework;
using Google.ProtocolBuffers.TestProtos;
using Google.ProtocolBuffers.Serialization;
namespace Google.ProtocolBuffers
{
[TestFixture]
public class ReusableBuilderTest
{
[Test]
public void TestModifyDefaultInstance()
{
//verify that the default instance has correctly been marked as read-only
Assert.AreEqual(typeof(PopsicleList<bool>), TestAllTypes.DefaultInstance.RepeatedBoolList.GetType());
PopsicleList<bool> list = (PopsicleList<bool>)TestAllTypes.DefaultInstance.RepeatedBoolList;
Assert.IsTrue(list.IsReadOnly);
}
[Test]
public void TestUnmodifiedDefaultInstance()
{
//Simply calling ToBuilder().Build() no longer creates a copy of the message
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
}
[Test]
public void BuildMultipleWithoutChange()
{
//Calling Build() or BuildPartial() does not require a copy of the message
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
builder.SetDefaultBool(true);
TestAllTypes first = builder.BuildPartial();
//Still the same instance?
Assert.IsTrue(ReferenceEquals(first, builder.Build()));
//Still the same instance?
Assert.IsTrue(ReferenceEquals(first, builder.BuildPartial().ToBuilder().Build()));
}
[Test]
public void MergeFromDefaultInstance()
{
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
builder.MergeFrom(TestAllTypes.DefaultInstance);
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
}
[Test]
public void BuildNewBuilderIsDefaultInstance()
{
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, new TestAllTypes.Builder().Build()));
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, TestAllTypes.CreateBuilder().Build()));
//last test, if you clear a builder it reverts to default instance
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance,
TestAllTypes.CreateBuilder().SetOptionalBool(true).Build().ToBuilder().Clear().Build()));
}
[Test]
public void BuildModifyAndRebuild()
{
TestAllTypes.Builder b1 = new TestAllTypes.Builder();
b1.SetDefaultInt32(1);
b1.AddRepeatedInt32(2);
b1.SetOptionalForeignMessage(ForeignMessage.DefaultInstance);
TestAllTypes m1 = b1.Build();
b1.SetDefaultInt32(5);
b1.AddRepeatedInt32(6);
b1.SetOptionalForeignMessage(b1.OptionalForeignMessage.ToBuilder().SetC(7));
TestAllTypes m2 = b1.Build();
Assert.AreEqual("{\"optional_foreign_message\":{},\"repeated_int32\":[2],\"default_int32\":1}", m1.ToJson());
Assert.AreEqual("{\"optional_foreign_message\":{\"c\":7},\"repeated_int32\":[2,6],\"default_int32\":5}", m2.ToJson());
}
[Test]
public void CloneOnChangePrimitive()
{
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
builder.SetDefaultBool(true);
Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
}
[Test]
public void CloneOnAddRepeatedBool()
{
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
builder.AddRepeatedBool(true);
Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
}
[Test]
public void CloneOnGetRepeatedBoolList()
{
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
GC.KeepAlive(builder.RepeatedBoolList);
Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
}
[Test]
public void CloneOnChangeMessage()
{
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
builder.SetOptionalForeignMessage(new ForeignMessage.Builder());
Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
}
[Test]
public void CloneOnClearMessage()
{
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
builder.ClearOptionalForeignMessage();
Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
}
[Test]
public void CloneOnGetRepeatedForeignMessageList()
{
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
GC.KeepAlive(builder.RepeatedForeignMessageList);
Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
}
[Test]
public void CloneOnChangeEnumValue()
{
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
builder.SetOptionalForeignEnum(ForeignEnum.FOREIGN_BAR);
Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
}
[Test]
public void CloneOnGetRepeatedForeignEnumList()
{
TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder();
Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
GC.KeepAlive(builder.RepeatedForeignEnumList);
Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build()));
}
}
}
......@@ -191,7 +191,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(OptionsMessage prototype) {
return (Builder) new Builder().MergeFrom(prototype);
return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
......@@ -201,22 +201,49 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
public Builder() {}
public Builder() {
result = DefaultInstance ?? new OptionsMessage();
builderIsReadOnly = result == DefaultInstance;
}
internal Builder(OptionsMessage cloneFrom) {
result = cloneFrom;
builderIsReadOnly = true;
}
bool builderIsReadOnly;
OptionsMessage result;
private OptionsMessage PrepareBuilder() {
if (builderIsReadOnly) {
OptionsMessage original = result;
result = new OptionsMessage();
builderIsReadOnly = false;
MergeFrom(original);
}
return result;
}
OptionsMessage result = new OptionsMessage();
public override bool IsInitialized {
get { return result.IsInitialized; }
}
protected override OptionsMessage MessageBeingBuilt {
get { return result; }
get { return PrepareBuilder(); }
}
public override Builder Clear() {
result = new OptionsMessage();
result = DefaultInstance ?? new OptionsMessage();
builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
if (builderIsReadOnly) {
return new Builder(result);
} else {
return new Builder().MergeFrom(result);
}
}
public override pbd::MessageDescriptor DescriptorForType {
get { return global::Google.ProtocolBuffers.TestProtos.OptionsMessage.Descriptor; }
......@@ -227,12 +254,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override OptionsMessage BuildPartial() {
if (result == null) {
throw new global::System.InvalidOperationException("build() has already been called on this Builder");
if (builderIsReadOnly) {
return result;
}
OptionsMessage returnMe = result;
result = null;
return returnMe;
builderIsReadOnly = true;
return result;
}
public override Builder MergeFrom(pb::IMessage other) {
......@@ -246,6 +272,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(OptionsMessage other) {
if (other == global::Google.ProtocolBuffers.TestProtos.OptionsMessage.DefaultInstance) return this;
PrepareBuilder();
if (other.HasNormal) {
Normal = other.Normal;
}
......@@ -264,6 +291,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
......@@ -328,11 +356,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetNormal(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
PrepareBuilder();
result.hasNormal = true;
result.normal_ = value;
return this;
}
public Builder ClearNormal() {
PrepareBuilder();
result.hasNormal = false;
result.normal_ = "";
return this;
......@@ -347,11 +377,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionsMessage_(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
PrepareBuilder();
result.hasOptionsMessage_ = true;
result.optionsMessage_ = value;
return this;
}
public Builder ClearOptionsMessage_() {
PrepareBuilder();
result.hasOptionsMessage_ = false;
result.optionsMessage_ = "";
return this;
......@@ -366,11 +398,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetCustomName(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
PrepareBuilder();
result.hasCustomName = true;
result.customized_ = value;
return this;
}
public Builder ClearCustomName() {
PrepareBuilder();
result.hasCustomName = false;
result.customized_ = "";
return this;
......
......@@ -187,7 +187,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestEmbedOptimizedForSize prototype) {
return (Builder) new Builder().MergeFrom(prototype);
return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
......@@ -197,22 +197,49 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
public Builder() {}
public Builder() {
result = DefaultInstance ?? new TestEmbedOptimizedForSize();
builderIsReadOnly = result == DefaultInstance;
}
internal Builder(TestEmbedOptimizedForSize cloneFrom) {
result = cloneFrom;
builderIsReadOnly = true;
}
bool builderIsReadOnly;
TestEmbedOptimizedForSize result;
private TestEmbedOptimizedForSize PrepareBuilder() {
if (builderIsReadOnly) {
TestEmbedOptimizedForSize original = result;
result = new TestEmbedOptimizedForSize();
builderIsReadOnly = false;
MergeFrom(original);
}
return result;
}
TestEmbedOptimizedForSize result = new TestEmbedOptimizedForSize();
public override bool IsInitialized {
get { return result.IsInitialized; }
}
protected override TestEmbedOptimizedForSize MessageBeingBuilt {
get { return result; }
get { return PrepareBuilder(); }
}
public override Builder Clear() {
result = new TestEmbedOptimizedForSize();
result = DefaultInstance ?? new TestEmbedOptimizedForSize();
builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
if (builderIsReadOnly) {
return new Builder(result);
} else {
return new Builder().MergeFrom(result);
}
}
public override pbd::MessageDescriptor DescriptorForType {
get { return global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize.Descriptor; }
......@@ -223,13 +250,12 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestEmbedOptimizedForSize BuildPartial() {
if (result == null) {
throw new global::System.InvalidOperationException("build() has already been called on this Builder");
if (builderIsReadOnly) {
return result;
}
result.repeatedMessage_.MakeReadOnly();
TestEmbedOptimizedForSize returnMe = result;
result = null;
return returnMe;
builderIsReadOnly = true;
return result;
}
public override Builder MergeFrom(pb::IMessage other) {
......@@ -243,6 +269,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestEmbedOptimizedForSize other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize.DefaultInstance) return this;
PrepareBuilder();
if (other.HasOptionalMessage) {
MergeOptionalMessage(other.OptionalMessage);
}
......@@ -258,6 +285,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
......@@ -323,18 +351,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
PrepareBuilder();
result.hasOptionalMessage = true;
result.optionalMessage_ = value;
return this;
}
public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
PrepareBuilder();
result.hasOptionalMessage = true;
result.optionalMessage_ = builderForValue.Build();
return this;
}
public Builder MergeOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
PrepareBuilder();
if (result.hasOptionalMessage &&
result.optionalMessage_ != global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance) {
result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.CreateBuilder(result.optionalMessage_).MergeFrom(value).BuildPartial();
......@@ -345,13 +376,14 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearOptionalMessage() {
PrepareBuilder();
result.hasOptionalMessage = false;
result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance;
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize> RepeatedMessageList {
get { return result.repeatedMessage_; }
get { return PrepareBuilder().repeatedMessage_; }
}
public int RepeatedMessageCount {
get { return result.RepeatedMessageCount; }
......@@ -361,29 +393,35 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
PrepareBuilder();
result.repeatedMessage_[index] = value;
return this;
}
public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
PrepareBuilder();
result.repeatedMessage_[index] = builderForValue.Build();
return this;
}
public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
PrepareBuilder();
result.repeatedMessage_.Add(value);
return this;
}
public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
PrepareBuilder();
result.repeatedMessage_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeRepeatedMessage(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize> values) {
PrepareBuilder();
result.repeatedMessage_.Add(values);
return this;
}
public Builder ClearRepeatedMessage() {
PrepareBuilder();
result.repeatedMessage_.Clear();
return this;
}
......
......@@ -151,7 +151,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(ImportMessageLite prototype) {
return (Builder) new Builder().MergeFrom(prototype);
return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
......@@ -161,34 +161,60 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
public Builder() {}
public Builder() {
result = DefaultInstance ?? new ImportMessageLite();
builderIsReadOnly = result == DefaultInstance;
}
internal Builder(ImportMessageLite cloneFrom) {
result = cloneFrom;
builderIsReadOnly = true;
}
bool builderIsReadOnly;
ImportMessageLite result;
private ImportMessageLite PrepareBuilder() {
if (builderIsReadOnly) {
ImportMessageLite original = result;
result = new ImportMessageLite();
builderIsReadOnly = false;
MergeFrom(original);
}
return result;
}
ImportMessageLite result = new ImportMessageLite();
public override bool IsInitialized {
get { return result.IsInitialized; }
}
protected override ImportMessageLite MessageBeingBuilt {
get { return result; }
get { return PrepareBuilder(); }
}
public override Builder Clear() {
result = new ImportMessageLite();
result = DefaultInstance ?? new ImportMessageLite();
builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
if (builderIsReadOnly) {
return new Builder(result);
} else {
return new Builder().MergeFrom(result);
}
}
public override ImportMessageLite DefaultInstanceForType {
get { return global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance; }
}
public override ImportMessageLite BuildPartial() {
if (result == null) {
throw new global::System.InvalidOperationException("build() has already been called on this Builder");
if (builderIsReadOnly) {
return result;
}
ImportMessageLite returnMe = result;
result = null;
return returnMe;
builderIsReadOnly = true;
return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
......@@ -202,6 +228,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(ImportMessageLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance) return this;
PrepareBuilder();
if (other.HasD) {
D = other.D;
}
......@@ -213,6 +240,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
......@@ -255,11 +283,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetD(value); }
}
public Builder SetD(int value) {
PrepareBuilder();
result.hasD = true;
result.d_ = value;
return this;
}
public Builder ClearD() {
PrepareBuilder();
result.hasD = false;
result.d_ = 0;
return this;
......
......@@ -170,7 +170,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(ImportMessage prototype) {
return (Builder) new Builder().MergeFrom(prototype);
return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
......@@ -180,22 +180,49 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
public Builder() {}
public Builder() {
result = DefaultInstance ?? new ImportMessage();
builderIsReadOnly = result == DefaultInstance;
}
internal Builder(ImportMessage cloneFrom) {
result = cloneFrom;
builderIsReadOnly = true;
}
bool builderIsReadOnly;
ImportMessage result;
private ImportMessage PrepareBuilder() {
if (builderIsReadOnly) {
ImportMessage original = result;
result = new ImportMessage();
builderIsReadOnly = false;
MergeFrom(original);
}
return result;
}
ImportMessage result = new ImportMessage();
public override bool IsInitialized {
get { return result.IsInitialized; }
}
protected override ImportMessage MessageBeingBuilt {
get { return result; }
get { return PrepareBuilder(); }
}
public override Builder Clear() {
result = new ImportMessage();
result = DefaultInstance ?? new ImportMessage();
builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
if (builderIsReadOnly) {
return new Builder(result);
} else {
return new Builder().MergeFrom(result);
}
}
public override pbd::MessageDescriptor DescriptorForType {
get { return global::Google.ProtocolBuffers.TestProtos.ImportMessage.Descriptor; }
......@@ -206,12 +233,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override ImportMessage BuildPartial() {
if (result == null) {
throw new global::System.InvalidOperationException("build() has already been called on this Builder");
if (builderIsReadOnly) {
return result;
}
ImportMessage returnMe = result;
result = null;
return returnMe;
builderIsReadOnly = true;
return result;
}
public override Builder MergeFrom(pb::IMessage other) {
......@@ -225,6 +251,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(ImportMessage other) {
if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) return this;
PrepareBuilder();
if (other.HasD) {
D = other.D;
}
......@@ -237,6 +264,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
......@@ -292,11 +320,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetD(value); }
}
public Builder SetD(int value) {
PrepareBuilder();
result.hasD = true;
result.d_ = value;
return this;
}
public Builder ClearD() {
PrepareBuilder();
result.hasD = false;
result.d_ = 0;
return this;
......
......@@ -184,7 +184,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestMessage prototype) {
return (Builder) new Builder().MergeFrom(prototype);
return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
......@@ -194,22 +194,49 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService {
protected override Builder ThisBuilder {
get { return this; }
}
public Builder() {}
public Builder() {
result = DefaultInstance ?? new TestMessage();
builderIsReadOnly = result == DefaultInstance;
}
internal Builder(TestMessage cloneFrom) {
result = cloneFrom;
builderIsReadOnly = true;
}
bool builderIsReadOnly;
TestMessage result;
private TestMessage PrepareBuilder() {
if (builderIsReadOnly) {
TestMessage original = result;
result = new TestMessage();
builderIsReadOnly = false;
MergeFrom(original);
}
return result;
}
TestMessage result = new TestMessage();
public override bool IsInitialized {
get { return result.IsInitialized; }
}
protected override TestMessage MessageBeingBuilt {
get { return result; }
get { return PrepareBuilder(); }
}
public override Builder Clear() {
result = new TestMessage();
result = DefaultInstance ?? new TestMessage();
builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
if (builderIsReadOnly) {
return new Builder(result);
} else {
return new Builder().MergeFrom(result);
}
}
public override pbd::MessageDescriptor DescriptorForType {
get { return global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.Descriptor; }
......@@ -220,12 +247,11 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService {
}
public override TestMessage BuildPartial() {
if (result == null) {
throw new global::System.InvalidOperationException("build() has already been called on this Builder");
if (builderIsReadOnly) {
return result;
}
TestMessage returnMe = result;
result = null;
return returnMe;
builderIsReadOnly = true;
return result;
}
public override Builder MergeFrom(pb::IMessage other) {
......@@ -239,6 +265,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService {
public override Builder MergeFrom(TestMessage other) {
if (other == global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.DefaultInstance) return this;
PrepareBuilder();
if (other.HasA) {
A = other.A;
}
......@@ -252,6 +279,7 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
......@@ -307,11 +335,13 @@ namespace Google.ProtocolBuffers.TestProtos.NoGenericService {
set { SetA(value); }
}
public Builder SetA(int value) {
PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder ClearA() {
PrepareBuilder();
result.hasA = false;
result.a_ = 0;
return this;
......
......@@ -58,12 +58,7 @@ namespace Google.ProtocolBuffers
protected internal FieldAccessorTable<TMessage, TBuilder> InternalFieldAccessors
{
get { return MessageBeingBuilt.FieldAccessorsFromBuilder; }
}
public override bool IsInitialized
{
get { return MessageBeingBuilt.IsInitialized; }
get { return DefaultInstanceForType.FieldAccessorsFromBuilder; }
}
public override IDictionary<FieldDescriptor, object> AllFields
......@@ -97,7 +92,7 @@ namespace Google.ProtocolBuffers
public override MessageDescriptor DescriptorForType
{
get { return MessageBeingBuilt.DescriptorForType; }
get { return DefaultInstanceForType.DescriptorForType; }
}
public override int GetRepeatedFieldCount(FieldDescriptor field)
......@@ -204,7 +199,7 @@ namespace Google.ProtocolBuffers
public override TMessage Build()
{
// If the message is null, we'll throw a more appropriate exception in BuildPartial.
if (MessageBeingBuilt != null && !IsInitialized)
if (!IsInitialized)
{
throw new UninitializedMessageException(MessageBeingBuilt);
}
......
......@@ -61,11 +61,6 @@ namespace Google.ProtocolBuffers
public abstract TBuilder MergeFrom(TMessage other);
public override bool IsInitialized
{
get { return MessageBeingBuilt.IsInitialized; }
}
/// <summary>
/// Called by derived classes to parse an unknown field.
/// </summary>
......@@ -96,7 +91,7 @@ namespace Google.ProtocolBuffers
public override TMessage Build()
{
// If the message is null, we'll throw a more appropriate exception in BuildPartial.
if (MessageBeingBuilt != null && !IsInitialized)
if (!IsInitialized)
{
throw new UninitializedMessageException(MessageBeingBuilt);
}
......
......@@ -151,7 +151,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(ImportMessageLite prototype) {
return (Builder) new Builder().MergeFrom(prototype);
return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
......@@ -161,34 +161,60 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
public Builder() {}
public Builder() {
result = DefaultInstance ?? new ImportMessageLite();
builderIsReadOnly = result == DefaultInstance;
}
internal Builder(ImportMessageLite cloneFrom) {
result = cloneFrom;
builderIsReadOnly = true;
}
bool builderIsReadOnly;
ImportMessageLite result;
private ImportMessageLite PrepareBuilder() {
if (builderIsReadOnly) {
ImportMessageLite original = result;
result = new ImportMessageLite();
builderIsReadOnly = false;
MergeFrom(original);
}
return result;
}
ImportMessageLite result = new ImportMessageLite();
public override bool IsInitialized {
get { return result.IsInitialized; }
}
protected override ImportMessageLite MessageBeingBuilt {
get { return result; }
get { return PrepareBuilder(); }
}
public override Builder Clear() {
result = new ImportMessageLite();
result = DefaultInstance ?? new ImportMessageLite();
builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
if (builderIsReadOnly) {
return new Builder(result);
} else {
return new Builder().MergeFrom(result);
}
}
public override ImportMessageLite DefaultInstanceForType {
get { return global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance; }
}
public override ImportMessageLite BuildPartial() {
if (result == null) {
throw new global::System.InvalidOperationException("build() has already been called on this Builder");
if (builderIsReadOnly) {
return result;
}
ImportMessageLite returnMe = result;
result = null;
return returnMe;
builderIsReadOnly = true;
return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
......@@ -202,6 +228,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(ImportMessageLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance) return this;
PrepareBuilder();
if (other.HasD) {
D = other.D;
}
......@@ -213,6 +240,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
......@@ -255,11 +283,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetD(value); }
}
public Builder SetD(int value) {
PrepareBuilder();
result.hasD = true;
result.d_ = value;
return this;
}
public Builder ClearD() {
PrepareBuilder();
result.hasD = false;
result.d_ = 0;
return this;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment