From 77f6b4dd243c4831ca9f60671020ffd48258c832 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 4 Sep 2019 14:50:21 +0200 Subject: [PATCH] Fixed mapping of return types for static methods --- .../Translation/ShaderSyntaxRewriter.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ComputeSharp.Shaders/Translation/ShaderSyntaxRewriter.cs b/src/ComputeSharp.Shaders/Translation/ShaderSyntaxRewriter.cs index b82f38b7..c00a0c82 100644 --- a/src/ComputeSharp.Shaders/Translation/ShaderSyntaxRewriter.cs +++ b/src/ComputeSharp.Shaders/Translation/ShaderSyntaxRewriter.cs @@ -105,5 +105,19 @@ namespace ComputeSharp.Shaders.Translation return syntaxNode; } + + /// + public override SyntaxNode VisitMethodDeclaration(MethodDeclarationSyntax node) + { + node = (MethodDeclarationSyntax)base.VisitMethodDeclaration(node); + + // Replace the return type node, if needed + if (!node.ReturnType.ToString().Equals("void")) + { + return node.ReplaceType(node.ReturnType); + } + + return node; + } } }