diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs index 6344b7fc..5d540445 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs @@ -101,7 +101,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter /// The collection of discovered instance methods for custom struct types. /// The collection of discovered constant definitions. /// The collection of produced instances. - public ShaderSourceRewriter( + private ShaderSourceRewriter( SemanticModelProvider semanticModel, ICollection discoveredTypes, IDictionary staticMethods, @@ -486,8 +486,15 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter return updatedNode; } - ShaderSourceRewriter shaderSourceRewriter = new(SemanticModel, DiscoveredTypes, this.staticMethods, this.instanceMethods, ConstantDefinitions, Diagnostics); - MethodDeclarationSyntax processedMethod = shaderSourceRewriter.Visit(methodNode)!.NormalizeWhitespace(eol: "\n").WithoutTrivia(); + ShaderSourceRewriter shaderSourceRewriter = new( + SemanticModel, + DiscoveredTypes, + this.staticMethods, + this.instanceMethods, + ConstantDefinitions, + Diagnostics); + + MethodDeclarationSyntax processedMethod = shaderSourceRewriter.Visit(methodNode)!.WithoutTrivia(); this.staticMethods.Add(method, processedMethod.WithIdentifier(Identifier(methodIdentifier))); } @@ -532,8 +539,15 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter return updatedNode; } - ShaderSourceRewriter shaderSourceRewriter = new(SemanticModel, DiscoveredTypes, this.instanceMethods, this.instanceMethods, ConstantDefinitions, Diagnostics); - MethodDeclarationSyntax processedMethod = shaderSourceRewriter.Visit(methodNode)!.NormalizeWhitespace(eol: "\n").WithoutTrivia(); + ShaderSourceRewriter shaderSourceRewriter = new( + SemanticModel, + DiscoveredTypes, + this.instanceMethods, + this.instanceMethods, + ConstantDefinitions, + Diagnostics); + + MethodDeclarationSyntax processedMethod = shaderSourceRewriter.Visit(methodNode)!.WithoutTrivia(); this.instanceMethods.Add(method, processedMethod.WithIdentifier(Identifier(methodIdentifier))); }