diff --git a/src/ComputeSharp.Core.SourceGenerators/AutoConstructorGenerator.cs b/src/ComputeSharp.Core.SourceGenerators/AutoConstructorGenerator.cs
index 0eeb5abb..c4d20e61 100644
--- a/src/ComputeSharp.Core.SourceGenerators/AutoConstructorGenerator.cs
+++ b/src/ComputeSharp.Core.SourceGenerators/AutoConstructorGenerator.cs
@@ -26,8 +26,8 @@ public sealed class AutoConstructorGenerator : IIncrementalGenerator
context.SyntaxProvider
.ForAttributeWithMetadataName(
typeof(AutoConstructorAttribute).FullName,
- static (node, token) => node is StructDeclarationSyntax structDeclaration,
- static (context, token) =>
+ static (node, _) => node is StructDeclarationSyntax structDeclaration,
+ static (context, _) =>
{
INamedTypeSymbol typeSymbol = (INamedTypeSymbol)context.TargetSymbol;
diff --git a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs
index fb64cfa0..ec82efbd 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs
+++ b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderSourceGenerator.cs
@@ -20,42 +20,40 @@ public sealed partial class D2DPixelShaderSourceGenerator : IIncrementalGenerato
///
public void Initialize(IncrementalGeneratorInitializationContext context)
{
- // Get all method declarations with the [D2DPixelShaderSource] attribute
- IncrementalValuesProvider<(MethodDeclarationSyntax Syntax, IMethodSymbol Symbol)> methodDeclarationsAndSymbols =
+ // Get all method declarations with the [D2DPixelShaderSource] attribute and gather all necessary info
+ IncrementalValuesProvider<(HierarchyInfo Hierarchy, HlslShaderMethodSourceInfo Source, ImmutableArray Diagnostics)> shaderInfoWithErrors =
context.SyntaxProvider
.ForAttributeWithMetadataName(
typeof(D2DPixelShaderSourceAttribute).FullName,
- static (node, token) => node is MethodDeclarationSyntax,
- static (context, token) => ((MethodDeclarationSyntax)context.TargetNode, (IMethodSymbol)context.TargetSymbol));
+ static (node, _) => node is MethodDeclarationSyntax,
+ static (context, _) =>
+ {
+ MethodDeclarationSyntax methodDeclaration = (MethodDeclarationSyntax)context.TargetNode;
+ IMethodSymbol methodSymbol = (IMethodSymbol)context.TargetSymbol;
- // Gather info for all annotated methods
- IncrementalValuesProvider<(HierarchyInfo Hierarchy, HlslShaderMethodSourceInfo Source, ImmutableArray Diagnostics)> shaderInfoWithErrors =
- methodDeclarationsAndSymbols
- .Select(static (item, _) =>
- {
- ImmutableArray.Builder diagnostics = ImmutableArray.CreateBuilder();
+ ImmutableArray.Builder diagnostics = ImmutableArray.CreateBuilder();
- // Get all necessary info for the current shader
- ImmutableArray modifiers = item.Syntax.Modifiers.Select(token => token.Kind()).ToImmutableArray();
- string methodName = item.Symbol.Name;
- string? invalidReturnType = Execute.GetInvalidReturnType(diagnostics, item.Symbol);
- string hlslSource = Execute.GetHlslSource(diagnostics, item.Symbol);
- D2D1ShaderProfile shaderProfile = Execute.GetShaderProfile(diagnostics, item.Symbol);
- D2D1CompileOptions compileOptions = Execute.GetCompileOptions(diagnostics, item.Symbol);
+ // Get all necessary info for the current shader
+ ImmutableArray modifiers = methodDeclaration.Modifiers.Select(token => token.Kind()).ToImmutableArray();
+ string methodName = methodSymbol.Name;
+ string? invalidReturnType = Execute.GetInvalidReturnType(diagnostics, methodSymbol);
+ string hlslSource = Execute.GetHlslSource(diagnostics, methodSymbol);
+ D2D1ShaderProfile shaderProfile = Execute.GetShaderProfile(diagnostics, methodSymbol);
+ D2D1CompileOptions compileOptions = Execute.GetCompileOptions(diagnostics, methodSymbol);
- HlslShaderMethodSourceInfo sourceInfo = new(
- modifiers,
- methodName,
- invalidReturnType,
- hlslSource,
- shaderProfile,
- compileOptions,
- HasErrors: diagnostics.Count > 0);
+ HlslShaderMethodSourceInfo sourceInfo = new(
+ modifiers,
+ methodName,
+ invalidReturnType,
+ hlslSource,
+ shaderProfile,
+ compileOptions,
+ HasErrors: diagnostics.Count > 0);
- HierarchyInfo hierarchy = HierarchyInfo.From(item.Symbol.ContainingType!);
+ HierarchyInfo hierarchy = HierarchyInfo.From(methodSymbol.ContainingType!);
- return (hierarchy, sourceInfo, diagnostics.ToImmutable());
- });
+ return (hierarchy, sourceInfo, diagnostics.ToImmutable());
+ });
// Output the diagnostics
context.ReportDiagnostics(shaderInfoWithErrors.Select(static (item, _) => item.Diagnostics));