-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix interpolated strings in ScriptPropertyDefVal
- Loading branch information
Showing
5 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedComplexStrings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Godot; | ||
|
||
namespace Godot.SourceGenerators.Sample | ||
{ | ||
public partial class ExportedComplexStrings : Node | ||
{ | ||
[Export] | ||
private string _fieldInterpolated1 = $"The quick brown fox jumps over ({Engine.GetVersionInfo()})"; | ||
|
||
[Export] | ||
private string _fieldInterpolated2 = $"The quick brown fox jumps over ({Engine.GetVersionInfo()["major"],0:G}) the lazy dog."; | ||
|
||
[Export] | ||
private string _fieldInterpolated3 = $"{((int)Engine.GetVersionInfo()["major"]) * -1 * -1:G} the lazy dog."; | ||
|
||
[Export] | ||
private string _fieldInterpolated4 = $"{":::fff,,}<,<}},,}]"}"; | ||
|
||
[Export] | ||
public string PropertyInterpolated1 | ||
{ | ||
get; | ||
private set; | ||
} = $"The quick brown fox jumps over {GD.VarToStr($"the lazy {Engine.GetVersionInfo()} do")}g."; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
....Tests/TestData/GeneratedSources/ExportedComplexStrings_ScriptPropertyDefVal.generated.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
partial class ExportedComplexStrings | ||
{ | ||
#pragma warning disable CS0109 // Disable warning about redundant 'new' keyword | ||
#if TOOLS | ||
/// <summary> | ||
/// Get the default values for all properties declared in this class. | ||
/// This method is used by Godot to determine the value that will be | ||
/// used by the inspector when resetting properties. | ||
/// Do not call this method. | ||
/// </summary> | ||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] | ||
internal new static global::System.Collections.Generic.Dictionary<global::Godot.StringName, global::Godot.Variant> GetGodotPropertyDefaultValues() | ||
{ | ||
var values = new global::System.Collections.Generic.Dictionary<global::Godot.StringName, global::Godot.Variant>(5); | ||
string __PropertyInterpolated1_default_value = $"The quick brown fox jumps over {(global::Godot.GD.VarToStr($"the lazy {(global::Godot.Engine.GetVersionInfo())} do"))}g."; | ||
values.Add(PropertyName.PropertyInterpolated1, global::Godot.Variant.From<string>(__PropertyInterpolated1_default_value)); | ||
string ___fieldInterpolated1_default_value = $"The quick brown fox jumps over ({(global::Godot.Engine.GetVersionInfo())})"; | ||
values.Add(PropertyName._fieldInterpolated1, global::Godot.Variant.From<string>(___fieldInterpolated1_default_value)); | ||
string ___fieldInterpolated2_default_value = $"The quick brown fox jumps over ({(global::Godot.Engine.GetVersionInfo()["major"]),0:G}) the lazy dog."; | ||
values.Add(PropertyName._fieldInterpolated2, global::Godot.Variant.From<string>(___fieldInterpolated2_default_value)); | ||
string ___fieldInterpolated3_default_value = $"{(((int)global::Godot.Engine.GetVersionInfo()["major"]) * -1 * -1):G} the lazy dog."; | ||
values.Add(PropertyName._fieldInterpolated3, global::Godot.Variant.From<string>(___fieldInterpolated3_default_value)); | ||
string ___fieldInterpolated4_default_value = $"{(":::fff,,}<,<}},,}]")}"; | ||
values.Add(PropertyName._fieldInterpolated4, global::Godot.Variant.From<string>(___fieldInterpolated4_default_value)); | ||
return values; | ||
} | ||
#endif // TOOLS | ||
#pragma warning restore CS0109 | ||
} |
23 changes: 23 additions & 0 deletions
23
...tor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/Sources/ExportedComplexStrings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Godot; | ||
|
||
public partial class ExportedComplexStrings : Node | ||
{ | ||
[Export] | ||
private string _fieldInterpolated1 = $"The quick brown fox jumps over ({Engine.GetVersionInfo()})"; | ||
|
||
[Export] | ||
private string _fieldInterpolated2 = $"The quick brown fox jumps over ({Engine.GetVersionInfo()["major"],0:G}) the lazy dog."; | ||
|
||
[Export] | ||
private string _fieldInterpolated3 = $"{((int)Engine.GetVersionInfo()["major"]) * -1 * -1:G} the lazy dog."; | ||
|
||
[Export] | ||
private string _fieldInterpolated4 = $"{":::fff,,}<,<}},,}]"}"; | ||
|
||
[Export] | ||
public string PropertyInterpolated1 | ||
{ | ||
get; | ||
private set; | ||
} = $"The quick brown fox jumps over {GD.VarToStr($"the lazy {Engine.GetVersionInfo()} do")}g."; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters