20 lines
641 B
C#
20 lines
641 B
C#
using System.Collections.Generic;
|
|
using Microsoft.CodeAnalysis;
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
namespace InterfaceGenerator
|
|
{
|
|
internal class SyntaxReceiver : ISyntaxReceiver
|
|
{
|
|
public IList<ClassDeclarationSyntax> CandidateClasses { get; } = new List<ClassDeclarationSyntax>();
|
|
|
|
public void OnVisitSyntaxNode(SyntaxNode syntaxNode)
|
|
{
|
|
if (syntaxNode is ClassDeclarationSyntax classDeclarationSyntax &&
|
|
classDeclarationSyntax.AttributeLists.Count > 0)
|
|
{
|
|
CandidateClasses.Add(classDeclarationSyntax);
|
|
}
|
|
}
|
|
}
|
|
} |