From 37d396ac77134768605b1e7245a93fffb1cd1a7b Mon Sep 17 00:00:00 2001 From: nenoNaninu Date: Wed, 10 Jan 2024 00:35:42 +0900 Subject: [PATCH] update TypeValidator --- .../CodeAnalysis/Shared/TypeValidator.cs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/TypedSignalR.Client.DevTools.Specification/CodeAnalysis/Shared/TypeValidator.cs b/src/TypedSignalR.Client.DevTools.Specification/CodeAnalysis/Shared/TypeValidator.cs index c103339..626a7a4 100644 --- a/src/TypedSignalR.Client.DevTools.Specification/CodeAnalysis/Shared/TypeValidator.cs +++ b/src/TypedSignalR.Client.DevTools.Specification/CodeAnalysis/Shared/TypeValidator.cs @@ -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) {