Initial implementation of LoadResourceTextureDescriptions generator
このコミットが含まれているのは:
1 親
b28d3f2500
コミット
8b42c7011e
12ファイル変更
+437
-15
検索条件に一致するファイルはありません
@@ -8,6 +8,29 @@ namespace ComputeSharp.SourceGeneration.Extensions;
|
||||
/// </summary>
|
||||
internal static class AttributeDataExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Tries to get a constructor argument at a given index from the input <see cref="AttributeData"/> instance.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of constructor argument to retrieve.</typeparam>
|
||||
/// <param name="attributeData">The target <see cref="AttributeData"/> instance to get the argument from.</param>
|
||||
/// <param name="index">The index of the argument to try to retrieve.</param>
|
||||
/// <param name="result">The resulting argument, if it was found.</param>
|
||||
/// <returns>Whether or not an argument of type <typeparamref name="T"/> at position <paramref name="index"/> was found.</returns>
|
||||
public static bool TryGetConstructorArgument<T>(this AttributeData attributeData, int index, out T? result)
|
||||
{
|
||||
if (attributeData.ConstructorArguments.Length >= index + 1 &&
|
||||
attributeData.ConstructorArguments[index].Value is T argument)
|
||||
{
|
||||
result = argument;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
result = default;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to get a given named argument value from an <see cref="AttributeData"/> instance, if present.
|
||||
/// </summary>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする