Removed ComputeSharp.Core reference from generator

このコミットが含まれているのは:
Sergio Pedri committed 2020-12-19 12:54:34 +01:00
1 親 fa3b6cb1f6
コミット 99529c3688
4ファイル変更
+47 -7

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

+12 -2
ファイルの表示
@@ -5,7 +5,6 @@ using System.Diagnostics.Contracts;
using System.Reflection;
using ComputeSharp.Core.Extensions;
using ComputeSharp.Exceptions;
using Microsoft.Toolkit.Diagnostics;
namespace ComputeSharp
{
@@ -79,7 +78,10 @@ namespace ComputeSharp
[Pure]
internal static ShaderMethodSourceAttribute GetForDelegate(Delegate function)
{
Guard.IsTrue(function.Method.IsStatic, "Captured delegates need to wrap static methods");
if (!function.Method.IsStatic)
{
ThrowArgumentExceptionForNonStaticShader();
}
var attributes = function.Method.DeclaringType!.Assembly.GetCustomAttributes<ShaderMethodSourceAttribute>();
string methodName = function.Method.GetFullName();
@@ -94,5 +96,13 @@ namespace ComputeSharp
return MissingMethodSourceException.Throw(function);
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> when a given <see cref="Delegate"/> is not static.
/// </summary>
private static void ThrowArgumentExceptionForNonStaticShader()
{
throw new ArgumentException("Captured delegates in a shader need to wrap a static method.", "function");
}
}
}
+1 -1
ファイルの表示
@@ -19,7 +19,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Toolkit" Version="7.0.0-preview4" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<!--Hide the package references when this assembly is being packed with the source generator-->
<PackageReference Condition="'$(BuildingPackageForSourceGenerator)' == 'true'" Update="@(PackageReference)" PrivateAssets="all" />