blob: b30451e18c8cfa7fe4e53c9cf84e7fe562abf8f1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace I2R.Endpoints.Generator;
public class EndpointFinder : ISyntaxReceiver
{
public HashSet<ClassDeclarationSyntax> Endpoints { get; } = new();
public void OnVisitSyntaxNode(SyntaxNode syntaxNode) {
if (syntaxNode is not ClassDeclarationSyntax endpoint) return;
if ((endpoint.BaseList?.Types.Any(c => EndpointGenerator.IsSyncEndpoint(c.ToString())) ?? false)
|| (endpoint.BaseList?.Types.Any(c => EndpointGenerator.IsAyncEndpoint(c.ToString())) ?? false)) {
Endpoints.Add(endpoint);
}
}
}
|