From 3f12540e03f2f8fc541350913ebaabfc07998385 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 5 Sep 2019 23:13:16 +0200 Subject: [PATCH] Added missing code formatting for implicit local functions --- src/ComputeSharp.Shaders/Translation/ShaderLoader.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ComputeSharp.Shaders/Translation/ShaderLoader.cs b/src/ComputeSharp.Shaders/Translation/ShaderLoader.cs index 79606206..beeb82ac 100644 --- a/src/ComputeSharp.Shaders/Translation/ShaderLoader.cs +++ b/src/ComputeSharp.Shaders/Translation/ShaderLoader.cs @@ -305,7 +305,14 @@ namespace ComputeSharp.Shaders.Translation // Extract the implicit local functions var locals = root.DescendantNodes().OfType().ToArray(); root = root.RemoveNodes(locals, SyntaxRemoveOptions.KeepNoTrivia); - _LocalFunctionsList.AddRange(locals.Select(local => new LocalFunctionInfo(local.ToFullString().RemoveLeftPadding().Trim(' ', '\r', '\n')))); + foreach (var local in locals) + { + string alignedLocal = local.ToFullString().RemoveLeftPadding().Trim(' ', '\r', '\n'); + alignedLocal = Regex.Replace(alignedLocal, @"(?<=\W)(\d+)[fFdD]", m => m.Groups[1].Value); + alignedLocal = HlslKnownKeywords.GetMappedText(alignedLocal); + + _LocalFunctionsList.Add(new LocalFunctionInfo(alignedLocal)); + } // Register the captured static members foreach (var member in syntaxRewriter.StaticMembers)