mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Co-authored-by: Paul <ritter.paul1+git@googlemail.com> Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
22 lines
840 B
C#
22 lines
840 B
C#
using System.Collections.Generic;
|
|
using Microsoft.CodeAnalysis;
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
namespace Robust.Client.NameGenerator
|
|
{
|
|
/// <summary>
|
|
/// Taken from https://github.com/AvaloniaUI/Avalonia.NameGenerator/blob/ecc9677a23de5cbc90af07ccac14e31c0da41d6a/src/Avalonia.NameGenerator/NameReferenceSyntaxReceiver.cs
|
|
/// </summary>
|
|
internal class NameReferenceSyntaxReceiver : ISyntaxReceiver
|
|
{
|
|
public List<ClassDeclarationSyntax> CandidateClasses { get; } = new List<ClassDeclarationSyntax>();
|
|
|
|
public void OnVisitSyntaxNode(SyntaxNode syntaxNode)
|
|
{
|
|
if (syntaxNode is ClassDeclarationSyntax classDeclarationSyntax &&
|
|
classDeclarationSyntax.AttributeLists.Count > 0)
|
|
CandidateClasses.Add(classDeclarationSyntax);
|
|
}
|
|
}
|
|
}
|