Enable generation for ID2D1Shader.LoadInputDescriptions API
このコミットが含まれているのは:
1 親
54d7cb53e2
コミット
3b760f02d4
11ファイル変更
+386
-1
検索条件に一致するファイルはありません
@@ -0,0 +1,35 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.CodeAnalysis;
|
||||
|
||||
namespace ComputeSharp.SourceGeneration.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for the <see cref="AttributeData"/> type.
|
||||
/// </summary>
|
||||
internal static class AttributeDataExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Tries to get a given named argument value from an <see cref="AttributeData"/> instance, if present.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of argument to check.</typeparam>
|
||||
/// <param name="attributeData">The target <see cref="AttributeData"/> instance to check.</param>
|
||||
/// <param name="name">The name of the argument to check.</param>
|
||||
/// <param name="value">The resulting argument value, if present.</param>
|
||||
/// <returns>Whether or not <paramref name="attributeData"/> contains an argument named <paramref name="name"/> with a valid value.</returns>
|
||||
public static bool TryGetNamedArgument<T>(this AttributeData attributeData, string name, out T? value)
|
||||
{
|
||||
foreach (KeyValuePair<string, TypedConstant> properties in attributeData.NamedArguments)
|
||||
{
|
||||
if (properties.Key == name)
|
||||
{
|
||||
value = (T?)properties.Value.Value;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
value = default;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする