mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-29 23:56:25 +02:00
misc: chore: Use collection expressions in Generator projects
This commit is contained in:
parent
45125c16cf
commit
2853f5b426
8 changed files with 27 additions and 27 deletions
|
@ -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)}";
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -46,21 +46,21 @@ namespace Spv.Generator
|
|||
{
|
||||
_version = version;
|
||||
_bound = 1;
|
||||
_capabilities = new List<Capability>();
|
||||
_extensions = new List<string>();
|
||||
_capabilities = [];
|
||||
_extensions = [];
|
||||
_extInstImports = new Dictionary<DeterministicStringKey, Instruction>();
|
||||
_addressingModel = AddressingModel.Logical;
|
||||
_memoryModel = MemoryModel.Simple;
|
||||
_entrypoints = new List<Instruction>();
|
||||
_executionModes = new List<Instruction>();
|
||||
_debug = new List<Instruction>();
|
||||
_annotations = new List<Instruction>();
|
||||
_entrypoints = [];
|
||||
_executionModes = [];
|
||||
_debug = [];
|
||||
_annotations = [];
|
||||
_typeDeclarations = new Dictionary<TypeDeclarationKey, Instruction>();
|
||||
_typeDeclarationsList = new List<Instruction>();
|
||||
_typeDeclarationsList = [];
|
||||
_constants = new Dictionary<ConstantKey, Instruction>();
|
||||
_globals = new List<Instruction>();
|
||||
_functionsDeclarations = new List<Instruction>();
|
||||
_functionsDefinitions = new List<Instruction>();
|
||||
_globals = [];
|
||||
_functionsDeclarations = [];
|
||||
_functionsDefinitions = [];
|
||||
|
||||
_instPool = instPool ?? new GeneratorPool<Instruction>();
|
||||
_integerPool = integerPool ?? new GeneratorPool<LiteralInteger>();
|
||||
|
@ -333,7 +333,7 @@ namespace Spv.Generator
|
|||
}
|
||||
|
||||
// Ensure that everything is in the right order in the declarations section.
|
||||
List<Instruction> declarations = new();
|
||||
List<Instruction> declarations = [];
|
||||
declarations.AddRange(_typeDeclarationsList);
|
||||
declarations.AddRange(_globals);
|
||||
declarations.AddRange(_constants.Values);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue