Fix analyzers triggering on unrelated partial methods

このコミットが含まれているのは:
Sergio Pedri committed 2024-01-07 00:44:08 +01:00
1 親 40874d5d16
コミット 09b22885a9
3ファイル変更
+19

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

@@ -1,5 +1,6 @@
using System.Collections.Immutable;
using System.Linq;
using ComputeSharp.SourceGeneration.Extensions;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using static ComputeSharp.SourceGeneration.Diagnostics.DiagnosticDescriptors;
@@ -42,6 +43,12 @@ public sealed class InvalidD2DPixelShaderSourceMethodReturnTypeAnalyzer : Diagno
return;
}
// Ignore methods without [D2DPixelShaderSource]
if (!methodSymbol.HasAttributeWithType(d2DPixelShaderSourceAttributeSymbol))
{
return;
}
// Emit a diagnostic if the return type is not ReadOnlySpan<byte>
if (!SymbolEqualityComparer.Default.Equals(methodSymbol.ReturnType, readOnlySpanOfByteSymbol))
{
@@ -39,6 +39,12 @@ public sealed class MissingD2DCompileOptionsOnD2DPixelShaderSourceMethodAnalyzer
return;
}
// Ignore methods without [D2DPixelShaderSource]
if (!methodSymbol.HasAttributeWithType(d2DPixelShaderSourceAttributeSymbol))
{
return;
}
// Emit a diagnostic if there is no compile options available at any level
if (!methodSymbol.HasAttributeWithType(d2DCompileOptionsAttributeSymbol) &&
!methodSymbol.ContainingAssembly.HasAttributeWithType(d2DCompileOptionsAttributeSymbol))
@@ -39,6 +39,12 @@ public sealed class MissingD2DShaderProfileOnD2DPixelShaderSourceMethodAnalyzer
return;
}
// Ignore methods without [D2DPixelShaderSource]
if (!methodSymbol.HasAttributeWithType(d2DPixelShaderSourceAttributeSymbol))
{
return;
}
// Emit a diagnostic if there is no shader profile available at any level
if (!methodSymbol.HasAttributeWithType(d2DShaderProfileAttributeSymbol) &&
!methodSymbol.ContainingAssembly.HasAttributeWithType(d2DShaderProfileAttributeSymbol))