Fixed checks for delegates with no captured variables

このコミットが含まれているのは:
Sergio Pedri committed 2019-09-05 17:10:16 +02:00
1 親 09eea2ddd5
コミット c1fe54c63e
2ファイル変更
+13 -2

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

+4 -2
ファイルの表示
@@ -160,7 +160,8 @@ namespace ComputeSharp.Shaders.Translation
foreach (FieldInfo fieldInfo in action.Method.DeclaringType.GetFields())
{
if (fieldInfo.FieldType.IsDelegate() &&
fieldInfo.GetValue(action.Target) is Delegate func && func.Method.IsStatic &&
fieldInfo.GetValue(action.Target) is Delegate func &&
(func.Method.IsStatic || func.Method.DeclaringType.IsStatelessDelegateContainer()) &&
(HlslKnownTypes.IsKnownScalarType(func.Method.ReturnType) || HlslKnownTypes.IsKnownVectorType(func.Method.ReturnType)) &&
fieldInfo.FieldType.GenericTypeArguments.All(type => HlslKnownTypes.IsKnownScalarType(type) ||
HlslKnownTypes.IsKnownVectorType(type)))
@@ -271,7 +272,8 @@ namespace ComputeSharp.Shaders.Translation
}
}
else if (fieldType.IsDelegate() &&
memberInfo.GetValue(Action.Target) is Delegate func && func.Method.IsStatic &&
memberInfo.GetValue(Action.Target) is Delegate func &&
(func.Method.IsStatic || func.Method.DeclaringType.IsStatelessDelegateContainer()) &&
(HlslKnownTypes.IsKnownScalarType(func.Method.ReturnType) || HlslKnownTypes.IsKnownVectorType(func.Method.ReturnType)) &&
fieldType.GenericTypeArguments.All(type => HlslKnownTypes.IsKnownScalarType(type) ||
HlslKnownTypes.IsKnownVectorType(type)))