You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
C#: Report diagnostic for Node exports in a type that doesn't derive from Node
This commit is contained in:
@@ -166,6 +166,15 @@ namespace Godot.SourceGenerators
|
||||
continue;
|
||||
}
|
||||
|
||||
if (marshalType == MarshalType.GodotObjectOrDerived)
|
||||
{
|
||||
if (!symbol.InheritsFrom("GodotSharp", "Godot.Node") &&
|
||||
propertyType.InheritsFrom("GodotSharp", "Godot.Node"))
|
||||
{
|
||||
Common.ReportOnlyNodesShouldExportNodes(context, property);
|
||||
}
|
||||
}
|
||||
|
||||
var propertyDeclarationSyntax = property.DeclaringSyntaxReferences
|
||||
.Select(r => r.GetSyntax() as PropertyDeclarationSyntax).FirstOrDefault();
|
||||
|
||||
@@ -261,6 +270,15 @@ namespace Godot.SourceGenerators
|
||||
continue;
|
||||
}
|
||||
|
||||
if (marshalType == MarshalType.GodotObjectOrDerived)
|
||||
{
|
||||
if (!symbol.InheritsFrom("GodotSharp", "Godot.Node") &&
|
||||
fieldType.InheritsFrom("GodotSharp", "Godot.Node"))
|
||||
{
|
||||
Common.ReportOnlyNodesShouldExportNodes(context, field);
|
||||
}
|
||||
}
|
||||
|
||||
EqualsValueClauseSyntax? initializer = field.DeclaringSyntaxReferences
|
||||
.Select(r => r.GetSyntax())
|
||||
.OfType<VariableDeclaratorSyntax>()
|
||||
|
||||
Reference in New Issue
Block a user