From dac1b99f2ca0168087dcd9a3633d9da4ec43fc22 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 27 Aug 2022 23:40:09 +0200 Subject: [PATCH] Switch some ParseExpression calls to IdentifierName calls --- .../SyntaxRewriters/ShaderSourceRewriter.cs | 6 +++--- .../SyntaxRewriters/StaticFieldRewriter.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs index f5334d9b..8347860b 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs @@ -363,7 +363,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter // Allow specialized types to track the method invocation, if needed TrackKnownMethodInvocation(metadataName); - return updatedNode.WithExpression(ParseExpression(mapping!)); + return updatedNode.WithExpression(IdentifierName(mapping!)); } // Update the name if the target is a local function. The exact schema for the @@ -372,7 +372,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter { var functionIdentifier = $"__{this.currentMethod!.Identifier.Text}__{method.Name}"; - return updatedNode.WithExpression(ParseExpression(functionIdentifier)); + return updatedNode.WithExpression(IdentifierName(functionIdentifier)); } // If the method is an external static method, import and rewrite it as well. @@ -398,7 +398,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter this.staticMethods.Add(method, processedMethod.WithIdentifier(Identifier(methodIdentifier))); } - return updatedNode.WithExpression(ParseExpression(methodIdentifier)); + return updatedNode.WithExpression(IdentifierName(methodIdentifier)); } } else diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/StaticFieldRewriter.cs b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/StaticFieldRewriter.cs index 8c871706..9bef84d5 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/StaticFieldRewriter.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/StaticFieldRewriter.cs @@ -106,7 +106,7 @@ internal sealed partial class StaticFieldRewriter : HlslSourceRewriter mapping = HlslKnownMethods.GetMappedNameWithParameters(method.Name, method.Parameters.Select(static p => p.Type.Name)); } - return updatedNode.WithExpression(ParseExpression(mapping!)); + return updatedNode.WithExpression(IdentifierName(mapping!)); } }