Use ForAttributeWithMetadataName in AutoConstructorGenerator

Fix comment
このコミットが含まれているのは:
Sergio Pedri committed 2022-09-16 21:52:28 +02:00
1 親 4a26e8ec2a
コミット ca5b69fdcf
1ファイル変更
+3 -4
+3 -4
ファイルの表示
@@ -23,11 +23,10 @@ public sealed class AutoConstructorGenerator : IIncrementalGenerator
// Get all declared struct symbols with the [AutoConstructor] attribute
IncrementalValuesProvider<INamedTypeSymbol> structDeclarations =
context.SyntaxProvider
.CreateSyntaxProvider(
.ForAttributeWithMetadataName(
"ComputeSharp.AutoConstructorAttribute",
static (node, token) => node is StructDeclarationSyntax structDeclaration,
static (context, token) => (INamedTypeSymbol?)context.SemanticModel.GetDeclaredSymbol(context.Node, token))
.Where(static symbol => symbol is not null &&
symbol.GetAttributes().Any(static a => a.AttributeClass?.ToDisplayString() == typeof(AutoConstructorAttribute).FullName))!;
static (context, token) => (INamedTypeSymbol)context.TargetSymbol);
// Get the type hierarchy and fields info
IncrementalValuesProvider<(HierarchyInfo Left, ConstructorInfo Right)> constructorInfo =