1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

C#: Fix Generated ScriptProperty Error.

1. Add "this." to prevent errors caused by duplicate variable names.
2. Try to find the default value of property getters.
This commit is contained in:
Magian
2022-11-27 17:40:40 +08:00
parent f16c5b564b
commit c41196f0f3
3 changed files with 150 additions and 11 deletions

View File

@@ -292,7 +292,7 @@ namespace Godot.SourceGenerators
source.Append("if (name == PropertyName.")
.Append(propertyMemberName)
.Append(") {\n")
.Append(" ")
.Append(" this.")
.Append(propertyMemberName)
.Append(" = ")
.AppendNativeVariantToManagedExpr("value", propertyTypeSymbol, propertyMarshalType)
@@ -317,7 +317,7 @@ namespace Godot.SourceGenerators
.Append(propertyMemberName)
.Append(") {\n")
.Append(" value = ")
.AppendManagedToNativeVariantExpr(propertyMemberName, propertyMarshalType)
.AppendManagedToNativeVariantExpr("this." + propertyMemberName, propertyMarshalType)
.Append(";\n")
.Append(" return true;\n")
.Append(" }\n");