Skip to content

Commit

Permalink
CustomParserType initialization at Method
Browse files Browse the repository at this point in the history
  • Loading branch information
naratteu committed Aug 25, 2024
1 parent 6be2944 commit ea45660
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/ConsoleAppFramework/EquatableTypeSymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ public bool Equals(EquatableTypeSymbol other)
return this.TypeSymbol.EqualsNamespaceAndName(other.TypeSymbol);
}
}

static class EquatableTypeSymbolExtensions
{
public static EquatableTypeSymbol ToEquatable(this ITypeSymbol typeSymbol) => new(typeSymbol);
}
4 changes: 2 additions & 2 deletions src/ConsoleAppFramework/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ internal class Parser(DiagnosticReporter context, InvocationExpressionSyntax nod
Location = x.GetLocation(),
HasDefaultValue = hasDefault,
DefaultValue = defaultValue,
CustomParserType = customParserType == null ? null : new EquatableTypeSymbol(customParserType),
CustomParserType = customParserType?.ToEquatable(),
HasValidation = hasValidation,
IsCancellationToken = isCancellationToken,
IsFromServices = isFromServices,
Expand Down Expand Up @@ -520,7 +520,7 @@ internal class Parser(DiagnosticReporter context, InvocationExpressionSyntax nod
Type = new EquatableTypeSymbol(x.Type),
HasDefaultValue = x.HasExplicitDefaultValue,
DefaultValue = x.HasExplicitDefaultValue ? x.ExplicitDefaultValue : null,
CustomParserType = null,
CustomParserType = customParserType?.AttributeClass?.ToEquatable(),
IsCancellationToken = isCancellationToken,
IsFromServices = hasFromServices,
HasValidation = hasValidation,
Expand Down

0 comments on commit ea45660

Please sign in to comment.