2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-27 05:23:13 +00:00

Source Generation

This commit is contained in:
2021-05-17 05:34:09 +03:00
parent 5bf258673d
commit c8683e17e9
16 changed files with 148 additions and 57 deletions

View File

@ -11,7 +11,7 @@ namespace Esiur.Proxy
public class ResourceGeneratorReceiver : ISyntaxContextReceiver
{
public List<GenerationInfo> Classes { get; } = new();
public List<ResourceGeneratorClassInfo> Classes { get; } = new();
public void OnVisitSyntaxNode(GeneratorSyntaxContext context)
{
@ -23,11 +23,8 @@ namespace Esiur.Proxy
if (cls.GetAttributes().Any(a => a.AttributeClass.ToDisplayString() == "Esiur.Resource.ResourceAttribute"))
{
//if (!Debugger.IsAttached)
//{
// Debugger.Launch();
//}
var hasTrigger = cds.Members
.Where(x => x is MethodDeclarationSyntax)
.Select(x => context.SemanticModel.GetDeclaredSymbol(x) as IMethodSymbol)
@ -40,9 +37,16 @@ namespace Esiur.Proxy
.Where(x => x.GetAttributes().Any(a => a.AttributeClass.ToDisplayString() == "Esiur.Resource.PublicAttribute"))
.ToArray();
//if (!Debugger.IsAttached)
//{
// if (cls.Name == "User")
// Debugger.Launch();
//}
// get fields
Classes.Add(new GenerationInfo()
Classes.Add(new ResourceGeneratorClassInfo()
{
Name = cls.Name,
ClassDeclaration = cds,