-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(Generics): remove UnsupportedGenericType diagnostic and test * feat(Generics): add failing test and augment TypeData class * chore: move warning in FullyQualifiedTypeClass.Student * feat(Generics): add generic type parameters to builder class * improve(Modifiers) * feat(Generics): generic fluent API classes * test: GenericClassPrivateConstructor * refactor: rename GenericsInfo to GenericInfo * test: add failing test GenericClassWithConstraints * feat(Generics): add GenericTypeConstraint class * refactor(GenericInfo): make constructor internal * refactor: move generic classes to separate folder * feat(Generics): GenericConstraints and GenericTypeParameter abstractions * feat(Generics): class generics work * feat: split implemented interfaces across several lines * test: add GenericClassWithGenericMethod and GenericMethodWithConstraintsClass tests * docs(Readme): remove youtube and twitter reference * refactor: introduce Generics class * feat(Generics): add GenericInfo to MethodSymbolInfo * feat(Generics): generic methods * refactor: rename GenericsInfo to GenericInfo * fix(GenericConstraints): remove unused property ParametersWithConstraints * refactor: add GenericConstraintClause class * fix: formatting * refactor: memberToSetMemberCode and methodToCallMethodCode (wip) * refactor: introduce class InnerBodyCreationDelegates * docs: improve clarifying comments * feat(Generics): method overloads * test: improve GenericClassWithGenericMethod test * feat(Generics): get generic method via reflection * test: CanExecuteGenericClassWithGenericMethods * fix: MakeGenericMethod before Invoke for generic methods * test: CanExecuteGenericClassWithOverloadedGenericMethod * test: CanExecuteGenericClassWithPrivateOverloadedGenericMethod * test: rerun tests with new generated GetMethod code for private methods * test: detect duplicate overloaded methods * fix(InnerBodyCreationDelegates): don't compute method identities * improve: add blank lines between interface method signatures * fix: formatting * docs: add fluent api logo * chore: increase nuget versions to 1.2.0
- Loading branch information
Showing
137 changed files
with
3,507 additions
and
309 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
18 changes: 18 additions & 0 deletions
18
src/M31.FluentApi.Generator/CodeBuilding/GenericConstraintClause.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,18 @@ | ||
namespace M31.FluentApi.Generator.CodeBuilding; | ||
|
||
internal class GenericConstraintClause : ICode | ||
{ | ||
internal GenericConstraintClause(string parameter, IReadOnlyCollection<string> constraints) | ||
{ | ||
Parameter = parameter; | ||
Constraints = constraints; | ||
} | ||
|
||
internal string Parameter { get; } | ||
internal IReadOnlyCollection<string> Constraints { get; } | ||
|
||
public CodeBuilder AppendCode(CodeBuilder codeBuilder) | ||
{ | ||
return codeBuilder.Append($"where {Parameter} : {string.Join(", ", Constraints)}"); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/M31.FluentApi.Generator/CodeBuilding/GenericConstraints.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,29 @@ | ||
namespace M31.FluentApi.Generator.CodeBuilding; | ||
|
||
internal class GenericConstraints : ICode | ||
{ | ||
private readonly List<GenericConstraintClause> genericConstraintClauses; | ||
|
||
internal GenericConstraints() | ||
{ | ||
genericConstraintClauses = new List<GenericConstraintClause>(); | ||
} | ||
|
||
internal GenericConstraints(GenericConstraints constraints) | ||
{ | ||
genericConstraintClauses = constraints.genericConstraintClauses.ToList(); | ||
} | ||
|
||
internal IReadOnlyCollection<GenericConstraintClause> GenericConstraintClauses => genericConstraintClauses; | ||
internal int Count => genericConstraintClauses.Count; | ||
|
||
internal void Add(string parameter, IReadOnlyCollection<string> constraints) | ||
{ | ||
genericConstraintClauses.Add(new GenericConstraintClause(parameter, constraints)); | ||
} | ||
|
||
public CodeBuilder AppendCode(CodeBuilder codeBuilder) | ||
{ | ||
return codeBuilder.AppendNewLineSeparated(genericConstraintClauses); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/M31.FluentApi.Generator/CodeBuilding/GenericParameters.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,43 @@ | ||
namespace M31.FluentApi.Generator.CodeBuilding; | ||
|
||
internal class GenericParameters : ICode | ||
{ | ||
private readonly List<string> values; | ||
|
||
internal GenericParameters(params string[] parameters) | ||
{ | ||
values = parameters.ToList(); | ||
} | ||
|
||
internal GenericParameters(GenericParameters parameters) | ||
{ | ||
values = parameters.values.ToList(); | ||
} | ||
|
||
internal IReadOnlyCollection<string> Values => values; | ||
|
||
internal void Add(string parameter) | ||
{ | ||
values.Add(parameter); | ||
} | ||
|
||
internal void Add(params string[] parameters) | ||
{ | ||
values.AddRange(parameters); | ||
} | ||
|
||
internal void Add(IEnumerable<string> parameters) | ||
{ | ||
values.AddRange(parameters); | ||
} | ||
|
||
public CodeBuilder AppendCode(CodeBuilder codeBuilder) | ||
{ | ||
return codeBuilder.Append(() => $"<{string.Join(", ", values)}>", values.Count > 0); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return Values.Count == 0 ? string.Empty : $"<{string.Join(", ", values)}>"; | ||
} | ||
} |
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,29 @@ | ||
namespace M31.FluentApi.Generator.CodeBuilding; | ||
|
||
internal class Generics | ||
{ | ||
internal Generics() | ||
{ | ||
Parameters = new GenericParameters(); | ||
Constraints = new GenericConstraints(); | ||
} | ||
|
||
internal Generics(Generics generics) | ||
{ | ||
Parameters = new GenericParameters(generics.Parameters); | ||
Constraints = new GenericConstraints(generics.Constraints); | ||
} | ||
|
||
internal GenericParameters Parameters { get; } | ||
internal GenericConstraints Constraints { get; } | ||
|
||
internal void AddGenericParameter(string parameter, IEnumerable<string> constraints) | ||
{ | ||
Parameters.Add(parameter); | ||
IReadOnlyCollection<string> constraintsCollection = constraints.ToArray(); | ||
if (constraintsCollection.Count > 0) | ||
{ | ||
Constraints.Add(parameter, constraintsCollection); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.