misc: chore: Use collection expressions

This commit is contained in:
KeatonTheBot 2025-03-06 20:46:29 -06:00
parent 4d5757417e
commit e2973a875a
236 changed files with 9843 additions and 7561 deletions

View file

@ -232,14 +232,14 @@ namespace Spv.Generator
private static readonly Dictionary<Specification.Op, string[]> _operandLabels = new()
{
{ Specification.Op.OpConstant, new [] { "Value" } },
{ Specification.Op.OpTypeInt, new [] { "Width", "Signed" } },
{ Specification.Op.OpTypeFloat, new [] { "Width" } },
{ Specification.Op.OpConstant, ["Value"] },
{ Specification.Op.OpTypeInt, ["Width", "Signed"] },
{ Specification.Op.OpTypeFloat, ["Width"] },
};
public override string ToString()
{
var labels = _operandLabels.TryGetValue(Opcode, out var opLabels) ? opLabels : Array.Empty<string>();
var labels = _operandLabels.TryGetValue(Opcode, out var opLabels) ? opLabels : [];
var result = _resultType == null ? string.Empty : $"{_resultType} ";
return $"{result}{Opcode}{_operands.ToString(labels)}";
}

View file

@ -53,7 +53,7 @@ namespace Spv.Generator
}
private readonly IEnumerable<IOperand> AllOperands => new[] { Operand1, Operand2, Operand3, Operand4, Operand5 }
.Concat(Overflow ?? Array.Empty<IOperand>())
.Concat(Overflow ?? [])
.Take(Count);
public readonly override string ToString()