Fixed an issue with local functions in external methods

このコミットが含まれているのは:
Sergio Pedri committed 2021-02-23 02:32:08 +01:00
1 親 8bf828da6d
コミット 36f2512cf6
3ファイル変更
+46 -22

検索条件に一致するファイルはありません

+6 -6
ファイルの表示
@@ -251,6 +251,12 @@ namespace ComputeSharp.SourceGenerators
// Rewrite the method syntax tree
MethodDeclarationSyntax? processedMethod = shaderSourceRewriter.Visit(methodDeclaration)!.WithoutTrivia();
// Emit the extracted local functions first
foreach (var localFunction in shaderSourceRewriter.LocalFunctions)
{
methods.Add(localFunction.Value);
}
// If the method is the shader entry point, do additional processing
if (isShaderEntryPoint)
{
@@ -259,12 +265,6 @@ namespace ComputeSharp.SourceGenerators
entryPoint = processedMethod.NormalizeWhitespace().ToFullString();
}
else methods.Add(processedMethod);
// Emit the extracted local functions
foreach (var localFunction in shaderSourceRewriter.LocalFunctions)
{
methods.Add(localFunction.Value);
}
}
return (entryPoint!, methods);