Add members-to-ignore to proxy data
This commit is contained in:
@@ -29,6 +29,11 @@ internal static class AttributeArgumentListParser
|
||||
|
||||
foreach (var argument in argumentList.Arguments.Skip(1))
|
||||
{
|
||||
if (TryParseAsStringArray(argument.Expression, out var membersToIgnore))
|
||||
{
|
||||
result = result with { MembersToIgnore = membersToIgnore };
|
||||
continue;
|
||||
}
|
||||
if (TryParseAsBoolean(argument.Expression, out var proxyBaseClasses))
|
||||
{
|
||||
result = result with { ProxyBaseClasses = proxyBaseClasses };
|
||||
@@ -87,4 +92,23 @@ internal static class AttributeArgumentListParser
|
||||
value = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool TryParseAsStringArray(ExpressionSyntax expressionSyntax, out string[] value)
|
||||
{
|
||||
if (expressionSyntax is ImplicitArrayCreationExpressionSyntax lmplicitArrayCreationExpressionSyntax)
|
||||
{
|
||||
var strings = new List<string>();
|
||||
foreach (var expression in lmplicitArrayCreationExpressionSyntax.Initializer.Expressions)
|
||||
{
|
||||
if (expression.GetFirstToken().Value is string s)
|
||||
{
|
||||
strings.Add(s);
|
||||
}
|
||||
}
|
||||
value = strings.ToArray();
|
||||
return true;
|
||||
}
|
||||
value = Array.Empty<string>();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user