Updated Generators
Removed un-nesscary Attribute generation, as now is part of core.
This commit is contained in:
parent
02d23935fa
commit
d96fbaf0e9
3 changed files with 8 additions and 54 deletions
|
|
@ -14,25 +14,8 @@ namespace Godot.Sharp.Extended.Generators;
|
|||
[Generator]
|
||||
public class ResourceGenerator : IIncrementalGenerator
|
||||
{
|
||||
private const string AttributeSourceCode = """
|
||||
// <auto-generated />
|
||||
namespace Godot.Sharp.Extended.Generators;
|
||||
|
||||
[System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Field)]
|
||||
public class ResourcePathAttribute : System.Attribute
|
||||
{
|
||||
public string Path { get; private set; }
|
||||
|
||||
public ResourcePathAttribute(string path) {
|
||||
Path = path;
|
||||
}
|
||||
}
|
||||
""";
|
||||
public void Initialize(IncrementalGeneratorInitializationContext context)
|
||||
{
|
||||
context.RegisterPostInitializationOutput(ctx => ctx.AddSource(
|
||||
"ResourcePathAttribute.g.cs",
|
||||
SourceText.From(AttributeSourceCode, Encoding.UTF8)));
|
||||
|
||||
var classPaths = context.SyntaxProvider
|
||||
.CreateSyntaxProvider(
|
||||
|
|
@ -82,7 +65,7 @@ public class ResourceGenerator : IIncrementalGenerator
|
|||
{
|
||||
var symbolInfo = ctx.SemanticModel.GetSymbolInfo(attributeSyntax);
|
||||
if (symbolInfo.Symbol is not IMethodSymbol attributeSymbol) continue;
|
||||
if (attributeSymbol.ContainingType.ToDisplayString() != "Godot.Sharp.Extended.Generators.ResourcePath") continue;
|
||||
if (attributeSymbol.ContainingType.ToDisplayString() != "Godot.Sharp.Extended.Attributes.ResourcePath") continue;
|
||||
var parameter = attributeSyntax.ArgumentList;
|
||||
var pathArgument = parameter?.Arguments[0];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue