- tweak: View autogenerator

This commit is contained in:
2025-07-02 21:32:51 +03:00
parent 9e95d68c4a
commit 517fadaab8
57 changed files with 316 additions and 286 deletions

View File

@@ -7,24 +7,6 @@ namespace Nebula.SourceGenerators;
public static class SourceHelper
{
public static void GenerateAttribute(string attributeName, string usage,
IncrementalGeneratorInitializationContext context)
{
var attributeSourceCode = $@"// <auto-generated/>
namespace SourceGen
{{
[System.AttributeUsage(System.AttributeTargets.{usage})]
public class {attributeName} : System.Attribute
{{
}}
}}";
context.RegisterPostInitializationOutput(ctx => ctx.AddSource(
$"{attributeName}.g.cs",
SourceText.From(attributeSourceCode, Encoding.UTF8)));
}
public static bool HasAttribute(ISymbol type, string attributeName)
{
foreach (var attribute in type.GetAttributes())