// Code temporarily yeeted from // https://github.com/mostmand/Cloneable/blob/master/Cloneable/CloneableGenerator.cs // because of NRT issue using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; namespace Cloneable { internal class SyntaxReceiver : ISyntaxReceiver { public IList CandidateClasses { get; } = new List(); /// /// Called for every syntax node in the compilation, we can inspect the nodes and save any information useful for generation /// public void OnVisitSyntaxNode(SyntaxNode syntaxNode) { // any field with at least one attribute is a candidate for being cloneable if (syntaxNode is ClassDeclarationSyntax classDeclarationSyntax && classDeclarationSyntax.AttributeLists.Count > 0) { CandidateClasses.Add(classDeclarationSyntax); } } } }