Replace ToArray() with collection expressions
このコミットが含まれているのは:
1 親
6897ecfcb2
コミット
358f378796
4ファイル変更
+6
-7
検索条件に一致するファイルはありません
@@ -46,7 +46,7 @@
|
||||
This is used eg. to replace Unsafe.SizeOf<T>() calls with just sizeof(T). The warning is not necessary
|
||||
since in order to use these APIs the caller already has to be in an unsafe context.
|
||||
-->
|
||||
<NoWarn>$(NoWarn);CS8500;IDE0305;IDE0028;IDE0300;IDE0301;IDE0302</NoWarn>
|
||||
<NoWarn>$(NoWarn);CS8500;IDE0028;IDE0300;IDE0301;IDE0302</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Centralized location for all generated artifacts -->
|
||||
|
||||
@@ -150,7 +150,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
|
||||
BlockSyntax implicitBlock = Block(this.implicitVariables.Select(static v => LocalDeclarationStatement(v)).ToArray());
|
||||
|
||||
// Add the tracked implicit declarations (at the start of the body)
|
||||
updatedNode = updatedNode.WithBody(implicitBlock).AddBodyStatements(updatedNode.Body!.Statements.ToArray());
|
||||
updatedNode = updatedNode.WithBody(implicitBlock).AddBodyStatements([.. updatedNode.Body!.Statements]);
|
||||
}
|
||||
|
||||
return updatedNode;
|
||||
@@ -184,7 +184,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
|
||||
{
|
||||
BlockSyntax implicitBlock = Block(this.implicitVariables.Select(static v => LocalDeclarationStatement(v)).ToArray());
|
||||
|
||||
updatedNode = updatedNode.WithBody(implicitBlock).AddBodyStatements(updatedNode.Body!.Statements.ToArray());
|
||||
updatedNode = updatedNode.WithBody(implicitBlock).AddBodyStatements([.. updatedNode.Body!.Statements]);
|
||||
}
|
||||
|
||||
return updatedNode;
|
||||
|
||||
@@ -162,7 +162,7 @@ internal readonly struct EquatableArray<T>(ImmutableArray<T> array) : IEquatable
|
||||
/// <returns>The newly instantiated array.</returns>
|
||||
public T[] ToArray()
|
||||
{
|
||||
return AsImmutableArray().ToArray();
|
||||
return [.. AsImmutableArray()];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace ComputeSharp.SourceGeneration.Helpers;
|
||||
@@ -64,7 +63,7 @@ internal struct ImmutableHashSetBuilder<T> : IDisposable
|
||||
/// <inheritdoc cref="ImmutableArray{T}.Builder.ToImmutable"/>
|
||||
public readonly ImmutableArray<T> ToImmutable()
|
||||
{
|
||||
T[] array = this.set!.ToArray();
|
||||
T[] array = [.. this.set!];
|
||||
|
||||
return Unsafe.As<T[], ImmutableArray<T>>(ref array);
|
||||
}
|
||||
@@ -72,7 +71,7 @@ internal struct ImmutableHashSetBuilder<T> : IDisposable
|
||||
/// <inheritdoc cref="ImmutableArray{T}.Builder.ToArray"/>
|
||||
public readonly T[] ToArray()
|
||||
{
|
||||
return this.set!.ToArray();
|
||||
return [.. this.set!];
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする