mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 06:01:14 +00:00
Merge pull request #82918 from raulsntos/dotnet/only-node-can-export-node
C#: Report diagnostic for Node exports in a type that doesn't derive from Node
This commit is contained in:
commit
bf41c6bd34
3 changed files with 44 additions and 1 deletions
|
|
@ -170,6 +170,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();
|
||||
|
||||
|
|
@ -265,6 +274,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>()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue