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

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

+11
ファイルの表示
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
namespace ComputeSharp.SourceGeneration.Extensions;
@@ -45,6 +46,16 @@ internal static class CompilationExtensions
return true;
}
/// <summary>
/// Checks whether the <c>AllowUnsafeBlocks</c> option is set for a given compilation.
/// </summary>
/// <param name="compilation">The <see cref="Compilation"/> object to check.</param>
/// <returns>Whether the <c>AllowUnsafeBlocks</c> option is set for <paramref name="compilation"/>.</returns>
public static bool IsAllowUnsafeBlocksEnabled(this Compilation compilation)
{
return compilation.Options is CSharpCompilationOptions { AllowUnsafe: true };
}
/// <summary>
/// <para>
/// Checks whether or not a type with a specified metadata name is accessible from a given <see cref="Compilation"/> instance.