Refactor with C# 12 features

This commit is contained in:
Tyrrrz
2023-12-10 22:51:57 +02:00
parent 5854f36756
commit 490398f773
68 changed files with 371 additions and 622 deletions

View File

@@ -5,36 +5,26 @@ using Microsoft.CodeAnalysis;
namespace CliFx.Analyzers.ObjectModel;
internal partial class CommandOptionSymbol : ICommandMemberSymbol
internal partial class CommandOptionSymbol(
IPropertySymbol property,
string? name,
char? shortName,
bool? isRequired,
ITypeSymbol? converterType,
IReadOnlyList<ITypeSymbol> validatorTypes
) : ICommandMemberSymbol
{
public IPropertySymbol Property { get; }
public IPropertySymbol Property { get; } = property;
public string? Name { get; }
public string? Name { get; } = name;
public char? ShortName { get; }
public char? ShortName { get; } = shortName;
public bool? IsRequired { get; }
public bool? IsRequired { get; } = isRequired;
public ITypeSymbol? ConverterType { get; }
public ITypeSymbol? ConverterType { get; } = converterType;
public IReadOnlyList<ITypeSymbol> ValidatorTypes { get; }
public CommandOptionSymbol(
IPropertySymbol property,
string? name,
char? shortName,
bool? isRequired,
ITypeSymbol? converterType,
IReadOnlyList<ITypeSymbol> validatorTypes
)
{
Property = property;
Name = name;
ShortName = shortName;
IsRequired = isRequired;
ConverterType = converterType;
ValidatorTypes = validatorTypes;
}
public IReadOnlyList<ITypeSymbol> ValidatorTypes { get; } = validatorTypes;
}
internal partial class CommandOptionSymbol

View File

@@ -5,36 +5,26 @@ using Microsoft.CodeAnalysis;
namespace CliFx.Analyzers.ObjectModel;
internal partial class CommandParameterSymbol : ICommandMemberSymbol
internal partial class CommandParameterSymbol(
IPropertySymbol property,
int order,
string? name,
bool? isRequired,
ITypeSymbol? converterType,
IReadOnlyList<ITypeSymbol> validatorTypes
) : ICommandMemberSymbol
{
public IPropertySymbol Property { get; }
public IPropertySymbol Property { get; } = property;
public int Order { get; }
public int Order { get; } = order;
public string? Name { get; }
public string? Name { get; } = name;
public bool? IsRequired { get; }
public bool? IsRequired { get; } = isRequired;
public ITypeSymbol? ConverterType { get; }
public ITypeSymbol? ConverterType { get; } = converterType;
public IReadOnlyList<ITypeSymbol> ValidatorTypes { get; }
public CommandParameterSymbol(
IPropertySymbol property,
int order,
string? name,
bool? isRequired,
ITypeSymbol? converterType,
IReadOnlyList<ITypeSymbol> validatorTypes
)
{
Property = property;
Order = order;
Name = name;
IsRequired = isRequired;
ConverterType = converterType;
ValidatorTypes = validatorTypes;
}
public IReadOnlyList<ITypeSymbol> ValidatorTypes { get; } = validatorTypes;
}
internal partial class CommandParameterSymbol