Skip to content

Commit

Permalink
Make it work with 'UnitOf<Ulid>'
Browse files Browse the repository at this point in the history
Funkest committed Feb 3, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 3ac1cc8 commit 2b0ebc7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/UnitGenerator/SourceGenerator.cs
Original file line number Diff line number Diff line change
@@ -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();

0 comments on commit 2b0ebc7

Please sign in to comment.