Add 'InvalidGeneratedCanvasEffectPropertyAnalyzer'

このコミットが含まれているのは:
Sergio Pedri committed 2024-10-17 21:41:03 -07:00
1 親 9f789d1bb3
コミット d37001d45d
4ファイル変更
+107

検索条件に一致するファイルはありません

+23
ファイルの表示
@@ -67,6 +67,29 @@ internal static class ITypeSymbolExtensions
return false;
}
/// <summary>
/// Checks whether or not a given <see cref="ITypeSymbol"/> inherits from a specified type.
/// </summary>
/// <param name="typeSymbol">The target <see cref="ITypeSymbol"/> instance to check.</param>
/// <param name="baseTypeSymbol">The <see cref="ITypeSymbol"/> instane to check for inheritance from.</param>
/// <returns>Whether or not <paramref name="typeSymbol"/> inherits from <paramref name="baseTypeSymbol"/>.</returns>
public static bool InheritsFromType(this ITypeSymbol typeSymbol, ITypeSymbol baseTypeSymbol)
{
INamedTypeSymbol? currentBaseTypeSymbol = typeSymbol.BaseType;
while (currentBaseTypeSymbol is not null)
{
if (SymbolEqualityComparer.Default.Equals(currentBaseTypeSymbol, baseTypeSymbol))
{
return true;
}
currentBaseTypeSymbol = currentBaseTypeSymbol.BaseType;
}
return false;
}
/// <summary>
/// Checks whether or not a given <see cref="ITypeSymbol"/> implements an interface of a specified type.
/// </summary>