misc: chore: Use collection expressions in Generator projects

This commit is contained in:
Evan Husted 2025-01-26 15:45:43 -06:00
parent 45125c16cf
commit 2853f5b426
8 changed files with 27 additions and 27 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()
{
string[] labels = _operandLabels.TryGetValue(Opcode, out string[] opLabels) ? opLabels : Array.Empty<string>();
string[] labels = _operandLabels.TryGetValue(Opcode, out string[] opLabels) ? opLabels : [];
string result = _resultType == null ? string.Empty : $"{_resultType} ";
return $"{result}{Opcode}{_operands.ToString(labels)}";
}