Use collection expressions in more places

このコミットが含まれているのは:
Sergio Pedri committed 2023-12-08 12:54:21 +01:00
1 親 95a1ecd5c4
コミット 058db06971
13ファイル変更
+33 -33

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

+1 -1
ファイルの表示
@@ -246,7 +246,7 @@ public sealed partial class D2DPixelShaderDescriptorGenerator : IIncrementalGene
item.Hierarchy.WriteSyntax(
state: item,
writer: writer,
baseTypes: new[] { $"global::ComputeSharp.D2D1.Descriptors.ID2D1PixelShaderDescriptor<{item.Hierarchy.Hierarchy[0].QualifiedName}>" },
baseTypes: [$"global::ComputeSharp.D2D1.Descriptors.ID2D1PixelShaderDescriptor<{item.Hierarchy.Hierarchy[0].QualifiedName}>"],
memberCallbacks: declaredMembers.WrittenSpan);
// If any generated types are needed, they go into a separate namespace
+1 -1
ファイルの表示
@@ -94,7 +94,7 @@ public sealed partial class D2DPixelShaderSourceGenerator : IIncrementalGenerato
state: item,
writer: writer,
baseTypes: [],
memberCallbacks: new IndentedTextWriter.Callback<D2D1PixelShaderSourceInfo>[] { Execute.WriteSyntax });
memberCallbacks: [Execute.WriteSyntax]);
context.AddSource($"{item.Hierarchy.FullyQualifiedMetadataName}.{item.MethodName}.g.cs", writer.ToString());
});
@@ -26,13 +26,13 @@ public sealed class InvalidEffectMetadataValueAnalyzer : DiagnosticAnalyzer
/// <summary>
/// The mapping of diagnostics to their attribute type names.
/// </summary>
private static readonly ImmutableDictionary<string, DiagnosticDescriptor> AttributeTypeNameToDiagnosticMapping = ImmutableDictionary.CreateRange(new[]
{
private static readonly ImmutableDictionary<string, DiagnosticDescriptor> AttributeTypeNameToDiagnosticMapping = ImmutableDictionary.CreateRange(
[
new KeyValuePair<string, DiagnosticDescriptor>("D2DEffectDisplayNameAttribute", InvalidD2DEffectDisplayNameAttributeValue),
new KeyValuePair<string, DiagnosticDescriptor>("D2DEffectDescriptionAttribute", InvalidD2DEffectDescriptionAttributeValue),
new KeyValuePair<string, DiagnosticDescriptor>("D2DEffectCategoryAttribute", InvalidD2DEffectCategoryAttributeValue),
new KeyValuePair<string, DiagnosticDescriptor>("D2DEffectAuthorAttribute", InvalidD2DEffectAuthorAttributeValue)
});
]);
/// <inheritdoc/>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create(
+7 -7
ファイルの表示
@@ -7,7 +7,7 @@ using System.Text.RegularExpressions;
using ComputeSharp.SourceGeneration.Extensions;
using Microsoft.CodeAnalysis;
#pragma warning disable RS1024
#pragma warning disable IDE0055, RS1024
namespace ComputeSharp.SourceGeneration.Mappings;
@@ -19,20 +19,20 @@ internal static partial class HlslKnownTypes
/// <summary>
/// Gets the set of HLSL vector types.
/// </summary>
public static IReadOnlyCollection<Type> KnownVectorTypes { get; } = new[]
{
public static IReadOnlyCollection<Type> KnownVectorTypes { get; } =
[
typeof(Bool2), typeof(Bool3), typeof(Bool4),
typeof(Int2), typeof(Int3), typeof(Int4),
typeof(UInt2), typeof(UInt3), typeof(UInt4),
typeof(Float2), typeof(Float3), typeof(Float4),
typeof(Double2), typeof(Double3), typeof(Double4)
};
];
/// <summary>
/// Gets the set of HLSL matrix types.
/// </summary>
public static IReadOnlyCollection<Type> KnownMatrixTypes { get; } = new[]
{
public static IReadOnlyCollection<Type> KnownMatrixTypes { get; } =
[
typeof(Bool1x1), typeof(Bool1x2), typeof(Bool1x3), typeof(Bool1x4),
typeof(Bool2x1), typeof(Bool2x2), typeof(Bool2x3), typeof(Bool2x4),
typeof(Bool3x1), typeof(Bool3x2), typeof(Bool3x3), typeof(Bool3x4),
@@ -53,7 +53,7 @@ internal static partial class HlslKnownTypes
typeof(Double2x1), typeof(Double2x2), typeof(Double2x3), typeof(Double2x4),
typeof(Double3x1), typeof(Double3x2), typeof(Double3x3), typeof(Double3x4),
typeof(Double4x1), typeof(Double4x2), typeof(Double4x3), typeof(Double4x4)
};
];
/// <summary>
/// The mapping of supported known types to HLSL types.
+1 -1
ファイルの表示
@@ -183,7 +183,7 @@ public sealed partial class ComputeShaderDescriptorGenerator : IIncrementalGener
item.Hierarchy.WriteSyntax(
state: item,
writer: writer,
baseTypes: new[] { $"global::ComputeSharp.Descriptors.IComputeShaderDescriptor<{item.Hierarchy.Hierarchy[0].QualifiedName}>" },
baseTypes: [$"global::ComputeSharp.Descriptors.IComputeShaderDescriptor<{item.Hierarchy.Hierarchy[0].QualifiedName}>"],
memberCallbacks: declaredMembers.WrittenSpan);
// Append any additional types as well
+3 -3
ファイルの表示
@@ -12,12 +12,12 @@ partial class HlslKnownTypes
/// <summary>
/// Gets the known HLSL dispatch types.
/// </summary>
public static IReadOnlyCollection<Type> HlslDispatchTypes { get; } = new[]
{
public static IReadOnlyCollection<Type> HlslDispatchTypes { get; } =
[
typeof(ThreadIds),
typeof(GroupIds),
typeof(GridIds)
};
];
/// <summary>
/// Checks whether or not a given type name matches a constant buffer type.