mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
C#: Disallow init-only properties
ReadOnly properties are currently not allowed because the generated code needs to set them, this also apply to `init` properties because they need to be set after initialization.
This commit is contained in:
parent
d0398f62f0
commit
03c26d6618
3 changed files with 7 additions and 7 deletions
|
|
@ -138,14 +138,14 @@ namespace Godot.SourceGenerators
|
|||
}
|
||||
|
||||
// TODO: We should still restore read-only properties after reloading assembly. Two possible ways: reflection or turn RestoreGodotObjectData into a constructor overload.
|
||||
// Ignore properties without a getter or without a setter. Godot properties must be both readable and writable.
|
||||
// Ignore properties without a getter, without a setter or with an init-only setter. Godot properties must be both readable and writable.
|
||||
if (property.IsWriteOnly)
|
||||
{
|
||||
Common.ReportExportedMemberIsWriteOnly(context, property);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (property.IsReadOnly)
|
||||
if (property.IsReadOnly || property.SetMethod!.IsInitOnly)
|
||||
{
|
||||
Common.ReportExportedMemberIsReadOnly(context, property);
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue