Skip to content

Commit

Permalink
update TypeValidator
Browse files Browse the repository at this point in the history
  • Loading branch information
nenoNaninu committed Jan 9, 2024
1 parent b508200 commit 37d396a
Showing 1 changed file with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,32 @@ public static bool ValidateReceiverTypeRule(
return false;
}

bool isValid = ValidateReceiverTypeRuleCore(context, receiverTypeSymbol, specialSymbols, accessLocation);

var allInterfaces = receiverTypeSymbol.AllInterfaces;

if (allInterfaces.IsEmpty)
{
return isValid;
}

foreach (var typeSymbol in allInterfaces)
{
isValid &= ValidateReceiverTypeRuleCore(context, typeSymbol, specialSymbols, accessLocation);
}

return isValid;
}

public static bool ValidateReceiverTypeRuleCore(
SourceProductionContext context,
ITypeSymbol typeSymbol,
SpecialSymbols specialSymbols,
Location accessLocation)
{
bool isValid = true;

foreach (ISymbol memberSymbol in receiverTypeSymbol.GetMembers())
foreach (ISymbol memberSymbol in typeSymbol.GetMembers())
{
if (memberSymbol is IMethodSymbol methodSymbol)
{
Expand Down

0 comments on commit 37d396a

Please sign in to comment.