Skip to content

Commit ea45660

Browse files
committed
CustomParserType initialization at Method
1 parent 6be2944 commit ea45660

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/ConsoleAppFramework/EquatableTypeSymbol.cs

+5
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@ public bool Equals(EquatableTypeSymbol other)
2626
return this.TypeSymbol.EqualsNamespaceAndName(other.TypeSymbol);
2727
}
2828
}
29+
30+
static class EquatableTypeSymbolExtensions
31+
{
32+
public static EquatableTypeSymbol ToEquatable(this ITypeSymbol typeSymbol) => new(typeSymbol);
33+
}

src/ConsoleAppFramework/Parser.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ internal class Parser(DiagnosticReporter context, InvocationExpressionSyntax nod
358358
Location = x.GetLocation(),
359359
HasDefaultValue = hasDefault,
360360
DefaultValue = defaultValue,
361-
CustomParserType = customParserType == null ? null : new EquatableTypeSymbol(customParserType),
361+
CustomParserType = customParserType?.ToEquatable(),
362362
HasValidation = hasValidation,
363363
IsCancellationToken = isCancellationToken,
364364
IsFromServices = isFromServices,
@@ -520,7 +520,7 @@ internal class Parser(DiagnosticReporter context, InvocationExpressionSyntax nod
520520
Type = new EquatableTypeSymbol(x.Type),
521521
HasDefaultValue = x.HasExplicitDefaultValue,
522522
DefaultValue = x.HasExplicitDefaultValue ? x.ExplicitDefaultValue : null,
523-
CustomParserType = null,
523+
CustomParserType = customParserType?.AttributeClass?.ToEquatable(),
524524
IsCancellationToken = isCancellationToken,
525525
IsFromServices = hasFromServices,
526526
HasValidation = hasValidation,

0 commit comments

Comments
 (0)