Fix issue with incomplete property overrides in C# sourcegen
This commit is contained in:
committed by
Raul Santos
parent
fa6cad230f
commit
4bb041de8b
+5
-6
@@ -178,8 +178,7 @@ namespace Godot.SourceGenerators
|
||||
|
||||
// Generate SetGodotClassPropertyValue
|
||||
|
||||
bool allPropertiesAreReadOnly = godotClassFields.All(fi => fi.FieldSymbol.IsReadOnly) &&
|
||||
godotClassProperties.All(pi => pi.PropertySymbol.IsReadOnly || pi.PropertySymbol.SetMethod!.IsInitOnly);
|
||||
bool allPropertiesAreReadOnly = godotClassFields.All(fi => fi.IsReadOnly) && godotClassProperties.All(pi => pi.IsReadOnly);
|
||||
|
||||
if (!allPropertiesAreReadOnly)
|
||||
{
|
||||
@@ -190,7 +189,7 @@ namespace Godot.SourceGenerators
|
||||
|
||||
foreach (var property in godotClassProperties)
|
||||
{
|
||||
if (property.PropertySymbol.IsReadOnly || property.PropertySymbol.SetMethod!.IsInitOnly)
|
||||
if (property.IsReadOnly)
|
||||
continue;
|
||||
|
||||
GeneratePropertySetter(property.PropertySymbol.Name,
|
||||
@@ -199,7 +198,7 @@ namespace Godot.SourceGenerators
|
||||
|
||||
foreach (var field in godotClassFields)
|
||||
{
|
||||
if (field.FieldSymbol.IsReadOnly)
|
||||
if (field.IsReadOnly)
|
||||
continue;
|
||||
|
||||
GeneratePropertySetter(field.FieldSymbol.Name,
|
||||
@@ -212,7 +211,7 @@ namespace Godot.SourceGenerators
|
||||
}
|
||||
|
||||
// Generate GetGodotClassPropertyValue
|
||||
bool allPropertiesAreWriteOnly = godotClassFields.Length == 0 && godotClassProperties.All(pi => pi.PropertySymbol.IsWriteOnly);
|
||||
bool allPropertiesAreWriteOnly = godotClassFields.Length == 0 && godotClassProperties.All(pi => pi.IsWriteOnly);
|
||||
|
||||
if (!allPropertiesAreWriteOnly)
|
||||
{
|
||||
@@ -448,7 +447,7 @@ namespace Godot.SourceGenerators
|
||||
|
||||
if (exportAttr != null && propertySymbol != null)
|
||||
{
|
||||
if (propertySymbol.GetMethod == null || propertySymbol.SetMethod == null || propertySymbol.SetMethod.IsInitOnly)
|
||||
if (propertySymbol.GetMethodOrBaseGetMethod() is null || propertySymbol.SetMethodOrBaseSetMethod() is not { IsInitOnly: false })
|
||||
{
|
||||
// Exports can be neither read-only nor write-only but the diagnostic errors for properties are already
|
||||
// reported by ScriptPropertyDefValGenerator.cs so just quit early here.
|
||||
|
||||
Reference in New Issue
Block a user