C#: Escape signal parameters

This commit is contained in:
Zae 2024-10-23 23:24:00 +08:00
parent 533c616cb8
commit 2a3d400dd8
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");