From 2a3d400dd8faebe29592d4b3f093ed885664816c Mon Sep 17 00:00:00 2001 From: Zae Date: Wed, 23 Oct 2024 23:24:00 +0800 Subject: [PATCH] C#: Escape signal parameters --- .../EventSignals_ScriptSignals.generated.cs | 4 ++-- .../Godot.SourceGenerators/ScriptSignalsGenerator.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/GeneratedSources/EventSignals_ScriptSignals.generated.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/GeneratedSources/EventSignals_ScriptSignals.generated.cs index f54058b0d96..5af859c06be 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/GeneratedSources/EventSignals_ScriptSignals.generated.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/GeneratedSources/EventSignals_ScriptSignals.generated.cs @@ -32,9 +32,9 @@ partial class EventSignals add => 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); } /// [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs index 702c50d4616..c7a74158510 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs @@ -295,7 +295,7 @@ namespace Godot.SourceGenerators for (int i = 0; i < paramCount; i++) { var paramSymbol = invokeMethodSymbol.Parameters[i]; - source.Append($"{paramSymbol.Type.FullQualifiedNameIncludeGlobal()} {paramSymbol.Name}"); + source.Append($"{paramSymbol.Type.FullQualifiedNameIncludeGlobal()} @{paramSymbol.Name}"); if (i < paramCount - 1) { source.Append(", "); @@ -310,11 +310,11 @@ namespace Godot.SourceGenerators if (paramSymbol.Type.TypeKind == TypeKind.Enum) { var underlyingType = ((INamedTypeSymbol)paramSymbol.Type).EnumUnderlyingType; - source.Append($", ({underlyingType.FullQualifiedNameIncludeGlobal()}){paramSymbol.Name}"); + source.Append($", ({underlyingType.FullQualifiedNameIncludeGlobal()})@{paramSymbol.Name}"); continue; } - source.Append($", {paramSymbol.Name}"); + source.Append($", @{paramSymbol.Name}"); } source.Append(");\n"); source.Append(" }\n");