summaryrefslogtreecommitdiffstats
path: root/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertyDefValGenerator.cs
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertyDefValGenerator.cs')
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertyDefValGenerator.cs20
1 files changed, 11 insertions, 9 deletions
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertyDefValGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertyDefValGenerator.cs
index 27e7632ff7..d12a0e8d14 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertyDefValGenerator.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertyDefValGenerator.cs
@@ -66,11 +66,13 @@ namespace Godot.SourceGenerators
)
{
INamespaceSymbol namespaceSymbol = symbol.ContainingNamespace;
- string classNs = namespaceSymbol != null && !namespaceSymbol.IsGlobalNamespace ?
- namespaceSymbol.FullQualifiedNameOmitGlobal() :
- string.Empty;
+ string classNs = namespaceSymbol is { IsGlobalNamespace: false }
+ ? namespaceSymbol.FullQualifiedNameOmitGlobal()
+ : string.Empty;
bool hasNamespace = classNs.Length != 0;
+ bool isNode = symbol.InheritsFrom("GodotSharp", GodotClasses.Node);
+
bool isInnerClass = symbol.ContainingType != null;
string uniqueHint = symbol.FullQualifiedNameOmitGlobal().SanitizeQualifiedNameForUniqueHint()
@@ -114,14 +116,14 @@ namespace Godot.SourceGenerators
var members = symbol.GetMembers();
var exportedProperties = members
- .Where(s => !s.IsStatic && s.Kind == SymbolKind.Property)
+ .Where(s => s.Kind == SymbolKind.Property)
.Cast<IPropertySymbol>()
.Where(s => s.GetAttributes()
.Any(a => a.AttributeClass?.IsGodotExportAttribute() ?? false))
.ToArray();
var exportedFields = members
- .Where(s => !s.IsStatic && s.Kind == SymbolKind.Field && !s.IsImplicitlyDeclared)
+ .Where(s => s.Kind == SymbolKind.Field && !s.IsImplicitlyDeclared)
.Cast<IFieldSymbol>()
.Where(s => s.GetAttributes()
.Any(a => a.AttributeClass?.IsGodotExportAttribute() ?? false))
@@ -198,13 +200,13 @@ namespace Godot.SourceGenerators
if (marshalType == MarshalType.GodotObjectOrDerived)
{
- if (!symbol.InheritsFrom("GodotSharp", "Godot.Node") &&
- propertyType.InheritsFrom("GodotSharp", "Godot.Node"))
+ if (!isNode && propertyType.InheritsFrom("GodotSharp", GodotClasses.Node))
{
context.ReportDiagnostic(Diagnostic.Create(
Common.OnlyNodesShouldExportNodesRule,
property.Locations.FirstLocationWithSourceTreeOrDefault()
));
+ continue;
}
}
@@ -317,13 +319,13 @@ namespace Godot.SourceGenerators
if (marshalType == MarshalType.GodotObjectOrDerived)
{
- if (!symbol.InheritsFrom("GodotSharp", "Godot.Node") &&
- fieldType.InheritsFrom("GodotSharp", "Godot.Node"))
+ if (!isNode && fieldType.InheritsFrom("GodotSharp", GodotClasses.Node))
{
context.ReportDiagnostic(Diagnostic.Create(
Common.OnlyNodesShouldExportNodesRule,
field.Locations.FirstLocationWithSourceTreeOrDefault()
));
+ continue;
}
}