Disable D2D1 generator if unsafe blocks are not allowed

このコミットが含まれているのは:
Sergio Pedri committed 2023-09-27 18:30:53 +02:00
1 親 33e0eb6f49
コミット 24ac70faa4
2ファイル変更
+17

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

+6
ファイルの表示
@@ -36,6 +36,12 @@ public sealed partial class ID2D1ShaderGenerator : IIncrementalGenerator
static (node, _) => node.IsTypeDeclarationWithOrPotentiallyWithBaseTypes<StructDeclarationSyntax>(),
static (context, token) =>
{
// The source generator requires unsafe blocks to be enabled (eg. for pointers, [SkipLocalsInit], etc.)
if (!context.SemanticModel.Compilation.IsAllowUnsafeBlocksEnabled())
{
return default;
}
StructDeclarationSyntax typeDeclaration = (StructDeclarationSyntax)context.Node;
// If the type symbol doesn't have at least one interface, it can't possibly be a shader type