diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-03-04 13:33:25 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-03-04 13:33:25 +0100 |
commit | 63154299997fdf8b7d724c68d2f13c36fd18f099 (patch) | |
tree | ba758a4d2cf6e7008521f0f6484b7a98baa3fcb0 /modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs | |
parent | 1a7f694b40c5e99f5621646222cd075c0ddfbf84 (diff) | |
parent | 42233284b1824d3dd4070556a690c92f89e19ce2 (diff) | |
download | redot-engine-63154299997fdf8b7d724c68d2f13c36fd18f099.tar.gz |
Merge pull request #89007 from paulloz/dotnet/fix-interpolated-string-scriptpropertydefval
[.NET] Fix interpolated strings in ScriptPropertyDefVal
Diffstat (limited to 'modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs')
-rw-r--r-- | modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs index 9784bd0b78..957d5789df 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs @@ -208,7 +208,17 @@ namespace Godot.SourceGenerators if (child.IsNode) { - FullQualifiedSyntax(child.AsNode()!, sm, sb, isFirstNode: innerIsFirstNode); + var childNode = child.AsNode()!; + + if (node is InterpolationSyntax && childNode is ExpressionSyntax) + { + ParenEnclosedFullQualifiedSyntax(childNode, sm, sb, isFirstNode: innerIsFirstNode); + } + else + { + FullQualifiedSyntax(childNode, sm, sb, isFirstNode: innerIsFirstNode); + } + innerIsFirstNode = false; } else @@ -221,6 +231,13 @@ namespace Godot.SourceGenerators sb.Append(child.GetTrailingTrivia()); } } + + static void ParenEnclosedFullQualifiedSyntax(SyntaxNode node, SemanticModel sm, StringBuilder sb, bool isFirstNode) + { + sb.Append(SyntaxFactory.Token(SyntaxKind.OpenParenToken)); + FullQualifiedSyntax(node, sm, sb, isFirstNode); + sb.Append(SyntaxFactory.Token(SyntaxKind.CloseParenToken)); + } } public static string SanitizeQualifiedNameForUniqueHint(this string qualifiedName) |