From 2b0ebc7432b4b3cdfc9cc841154f5ab26b44dc1a Mon Sep 17 00:00:00 2001 From: Funkest Date: Sun, 4 Feb 2024 03:43:20 +0900 Subject: [PATCH] Make it work with 'UnitOf' --- src/UnitGenerator/SourceGenerator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UnitGenerator/SourceGenerator.cs b/src/UnitGenerator/SourceGenerator.cs index 468e8b1..7f87371 100644 --- a/src/UnitGenerator/SourceGenerator.cs +++ b/src/UnitGenerator/SourceGenerator.cs @@ -1357,7 +1357,7 @@ bool IsImplementedGenericSelfType(INamedTypeSymbol interfaceSymbol) class SyntaxReceiver : ISyntaxReceiver { - public List<(StructDeclarationSyntax type, AttributeSyntax attr, PredefinedTypeSyntax? targetType)> Targets { get; } = new(); + public List<(StructDeclarationSyntax type, AttributeSyntax attr, TypeSyntax? targetType)> Targets { get; } = new(); public void OnVisitSyntaxNode(SyntaxNode syntaxNode) { @@ -1372,7 +1372,7 @@ from attribute in attributesList.Attributes SimpleNameSyntax name => name.Identifier.Text, _ => attribute.Name.ToString(), } - let targetType = attribute.Name is GenericNameSyntax gName ? gName.TypeArgumentList.ChildNodes().FirstOrDefault() as PredefinedTypeSyntax : null + let targetType = attribute.Name is GenericNameSyntax gName ? gName.TypeArgumentList.ChildNodes().FirstOrDefault() as TypeSyntax : null where attributeName is "UnitOf" or "UnitOfAttribute" select new { attribute, targetType }).FirstOrDefault();