Merge pull request #98459 from zaevi/fix_csharp_signal_parameters

C#: Escape signal parameters
This commit is contained in:
Thaddeus Crews 2024-11-12 09:27:43 -06:00
commit 2705202ebb
No known key found for this signature in database
GPG Key ID: 62181B86FE9E5D84
2 changed files with 5 additions and 5 deletions

View File

@ -32,9 +32,9 @@ partial class EventSignals
add => backing_MySignal += value; add => backing_MySignal += value;
remove => backing_MySignal -= value; remove => backing_MySignal -= value;
} }
protected void EmitSignalMySignal(string str, int num) protected void EmitSignalMySignal(string @str, int @num)
{ {
EmitSignal(SignalName.MySignal, str, num); EmitSignal(SignalName.MySignal, @str, @num);
} }
/// <inheritdoc/> /// <inheritdoc/>
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]

View File

@ -295,7 +295,7 @@ namespace Godot.SourceGenerators
for (int i = 0; i < paramCount; i++) for (int i = 0; i < paramCount; i++)
{ {
var paramSymbol = invokeMethodSymbol.Parameters[i]; var paramSymbol = invokeMethodSymbol.Parameters[i];
source.Append($"{paramSymbol.Type.FullQualifiedNameIncludeGlobal()} {paramSymbol.Name}"); source.Append($"{paramSymbol.Type.FullQualifiedNameIncludeGlobal()} @{paramSymbol.Name}");
if (i < paramCount - 1) if (i < paramCount - 1)
{ {
source.Append(", "); source.Append(", ");
@ -310,11 +310,11 @@ namespace Godot.SourceGenerators
if (paramSymbol.Type.TypeKind == TypeKind.Enum) if (paramSymbol.Type.TypeKind == TypeKind.Enum)
{ {
var underlyingType = ((INamedTypeSymbol)paramSymbol.Type).EnumUnderlyingType; var underlyingType = ((INamedTypeSymbol)paramSymbol.Type).EnumUnderlyingType;
source.Append($", ({underlyingType.FullQualifiedNameIncludeGlobal()}){paramSymbol.Name}"); source.Append($", ({underlyingType.FullQualifiedNameIncludeGlobal()})@{paramSymbol.Name}");
continue; continue;
} }
source.Append($", {paramSymbol.Name}"); source.Append($", @{paramSymbol.Name}");
} }
source.Append(");\n"); source.Append(");\n");
source.Append(" }\n"); source.Append(" }\n");