This commit is contained in:
Tyrrrz
2022-01-10 23:41:28 +02:00
parent 8e96d2701d
commit 4ff1e1d3e1
30 changed files with 184 additions and 165 deletions

View File

@@ -71,10 +71,9 @@ internal partial class CommandOptionSymbol
{
var attribute = TryGetOptionAttribute(property);
if (attribute is null)
return null;
return FromAttribute(attribute);
return attribute is not null
? FromAttribute(attribute)
: null;
}
public static bool IsOptionProperty(IPropertySymbol property) =>

View File

@@ -10,9 +10,9 @@ internal partial class CommandParameterSymbol
public int Order { get; }
public string? Name { get; }
public bool? IsRequired { get; }
public ITypeSymbol? ConverterType { get; }
public IReadOnlyList<ITypeSymbol> ValidatorTypes { get; }
@@ -41,7 +41,7 @@ internal partial class CommandParameterSymbol
private static CommandParameterSymbol FromAttribute(AttributeData attribute)
{
var order = (int) attribute
var order = (int)attribute
.ConstructorArguments
.Select(a => a.Value)
.First()!;
@@ -51,7 +51,7 @@ internal partial class CommandParameterSymbol
.Where(a => a.Key == "Name")
.Select(a => a.Value.Value)
.FirstOrDefault() as string;
var isRequired = attribute
.NamedArguments
.Where(a => a.Key == "IsRequired")