-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[c#] add support for init-only setters on generated classes
- Loading branch information
Showing
13 changed files
with
540 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
210 changes: 210 additions & 0 deletions
210
.../generated/constructor-parameters_init/collection-interfaces/complex_inheritance_types.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
|
||
|
||
// suppress "Missing XML comment for publicly visible type or member" | ||
#pragma warning disable 1591 | ||
|
||
|
||
#region ReSharper warnings | ||
// ReSharper disable PartialTypeWithSinglePart | ||
// ReSharper disable RedundantNameQualifier | ||
// ReSharper disable InconsistentNaming | ||
// ReSharper disable CheckNamespace | ||
// ReSharper disable UnusedParameter.Local | ||
// ReSharper disable RedundantUsingDirective | ||
#endregion | ||
|
||
namespace Test | ||
{ | ||
using System.Collections.Generic; | ||
|
||
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] | ||
public enum TestEnum | ||
{ | ||
EnumVal1, | ||
EnumVal2, | ||
EnumVal3, | ||
} | ||
|
||
[global::Bond.Schema] | ||
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] | ||
public partial class Simple | ||
{ | ||
[global::Bond.Id(0)] | ||
public int someInt { get; init; } | ||
|
||
[global::Bond.Id(1)] | ||
public int anotherInt { get; init; } | ||
|
||
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))] | ||
public string someString { get; init; } | ||
|
||
public Simple( | ||
int someInt, | ||
int anotherInt, | ||
string someString) | ||
{ | ||
this.someInt = someInt; | ||
this.anotherInt = anotherInt; | ||
this.someString = someString; | ||
} | ||
|
||
public Simple() | ||
{ | ||
someString = ""; | ||
} | ||
} | ||
|
||
[global::Bond.Schema] | ||
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] | ||
public partial class Foo | ||
{ | ||
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))] | ||
public string someText { get; init; } | ||
|
||
public Foo( | ||
string someText) | ||
{ | ||
this.someText = someText; | ||
} | ||
|
||
public Foo() | ||
{ | ||
someText = "BaseText1"; | ||
} | ||
} | ||
|
||
[global::Bond.Schema] | ||
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] | ||
public partial class Bar | ||
: Foo | ||
{ | ||
[global::Bond.Id(0)] | ||
public TestEnum testEnum { get; init; } | ||
|
||
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))] | ||
new public string someText { get; init; } | ||
|
||
[global::Bond.Id(2)] | ||
public int someInt { get; init; } | ||
|
||
[global::Bond.Id(3), global::Bond.Type(typeof(global::Bond.Tag.wstring))] | ||
public string moreText { get; init; } | ||
|
||
[global::Bond.Id(4), global::Bond.Type(typeof(List<Simple>))] | ||
public IList<Simple> someList { get; init; } | ||
|
||
[global::Bond.Id(5), global::Bond.Type(typeof(Dictionary<global::Bond.Tag.wstring, double>))] | ||
public IDictionary<string, double> someMap { get; init; } | ||
|
||
[global::Bond.Id(6), global::Bond.Type(typeof(HashSet<global::Bond.Tag.wstring>))] | ||
public ISet<string> someSet { get; init; } | ||
|
||
public Bar( | ||
// Base class parameters | ||
string someText, | ||
|
||
// This class parameters | ||
TestEnum testEnum, | ||
string someText0, | ||
int someInt, | ||
string moreText, | ||
IList<Simple> someList, | ||
IDictionary<string, double> someMap, | ||
ISet<string> someSet | ||
) : base( | ||
someText) | ||
{ | ||
this.testEnum = testEnum; | ||
this.someText = someText0; | ||
this.someInt = someInt; | ||
this.moreText = moreText; | ||
this.someList = someList; | ||
this.someMap = someMap; | ||
this.someSet = someSet; | ||
} | ||
|
||
public Bar() | ||
{ | ||
testEnum = TestEnum.Val2; | ||
someText = "DerivedText1"; | ||
moreText = ""; | ||
someList = new List<Simple>(); | ||
someMap = new Dictionary<string, double>(); | ||
someSet = new HashSet<string>(); | ||
} | ||
} | ||
|
||
[global::Bond.Schema] | ||
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] | ||
public partial class Baz | ||
: Bar | ||
{ | ||
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))] | ||
new public string someText { get; init; } | ||
|
||
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))] | ||
public string evenMoreText { get; init; } | ||
|
||
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))] | ||
public string someText1 { get; init; } | ||
|
||
public Baz( | ||
// Base class parameters | ||
string someText, | ||
TestEnum testEnum, | ||
string someText0, | ||
int someInt, | ||
string moreText, | ||
IList<Simple> someList, | ||
IDictionary<string, double> someMap, | ||
ISet<string> someSet, | ||
|
||
// This class parameters | ||
string someText1, | ||
string evenMoreText, | ||
string someText10 | ||
) : base( | ||
someText, | ||
testEnum, | ||
someText0, | ||
someInt, | ||
moreText, | ||
someList, | ||
someMap, | ||
someSet) | ||
{ | ||
this.someText = someText1; | ||
this.evenMoreText = evenMoreText; | ||
this.someText1 = someText10; | ||
} | ||
|
||
public Baz() | ||
{ | ||
someText = ""; | ||
evenMoreText = ""; | ||
someText1 = ""; | ||
} | ||
} | ||
|
||
[global::Bond.Schema] | ||
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] | ||
public partial class DerivedEmpty | ||
: Foo | ||
{ | ||
|
||
|
||
public DerivedEmpty( | ||
// Base class parameters | ||
string someText | ||
) : base( | ||
someText) | ||
{ | ||
|
||
} | ||
|
||
public DerivedEmpty() | ||
{ | ||
|
||
} | ||
} | ||
} // Test |
30 changes: 30 additions & 0 deletions
30
...r/tests/generated/constructor-parameters_init/collection-interfaces/empty_struct_types.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
|
||
// suppress "Missing XML comment for publicly visible type or member" | ||
#pragma warning disable 1591 | ||
|
||
|
||
#region ReSharper warnings | ||
// ReSharper disable PartialTypeWithSinglePart | ||
// ReSharper disable RedundantNameQualifier | ||
// ReSharper disable InconsistentNaming | ||
// ReSharper disable CheckNamespace | ||
// ReSharper disable UnusedParameter.Local | ||
// ReSharper disable RedundantUsingDirective | ||
#endregion | ||
|
||
namespace tests | ||
{ | ||
using System.Collections.Generic; | ||
|
||
[global::Bond.Schema] | ||
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")] | ||
public partial class Empty | ||
{ | ||
|
||
public Empty() | ||
{ | ||
|
||
} | ||
} | ||
} // tests |
Oops, something went wrong.