Address gdkchan's review comments

This commit is contained in:
TSR Berry 2022-12-17 20:14:06 +01:00
parent 17671611b2
commit d9230c09a5
No known key found for this signature in database
GPG key ID: 52353C0A4CCA15E2
2 changed files with 13 additions and 16 deletions

View file

@ -1,13 +1,13 @@
using Microsoft.CodeAnalysis;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.Build.Framework;
using Ryujinx.CustomTasks.Helper;
using Ryujinx.CustomTasks.SyntaxWalker;
using System.Collections.Generic;
using System.IO;
using Ryujinx.CustomTasks.SyntaxWalker;
using Ryujinx.CustomTasks.Helper;
using System.Linq;
using Task = Microsoft.Build.Utilities.Task;
namespace Ryujinx.CustomTasks
{
@ -16,7 +16,7 @@ namespace Ryujinx.CustomTasks
private const string InterfaceFileName = "IArray.g.cs";
private const string ArraysFileName = "Arrays.g.cs";
private readonly HashSet<string> _outputFiles = new HashSet<string>();
private readonly List<string> _outputFiles = new List<string>();
[Required]
public string ArrayNamespace { get; set; }
@ -55,23 +55,19 @@ namespace Ryujinx.CustomTasks
private void AddGeneratedSource(string filePath, string content)
{
bool addToOutputFiles = true;
if (File.Exists(filePath))
{
File.Delete(filePath);
addToOutputFiles = false;
}
File.WriteAllText(filePath, content);
if (addToOutputFiles)
else
{
_outputFiles.Add(filePath);
}
File.WriteAllText(filePath, content);
}
private HashSet<int> GetArraySizes(string itemPath)
private ICollection<int> GetArraySizes(string itemPath)
{
Log.LogMessage(MessageImportance.Low, $"Searching for StructArray types in: {itemPath}");

View file

@ -6,7 +6,8 @@ namespace Ryujinx.CustomTasks.SyntaxWalker
{
class ArraySizeCollector : CSharpSyntaxWalker
{
public HashSet<int> ArraySizes { get; } = new HashSet<int>();
private readonly HashSet<int> _arraySizes = new HashSet<int>();
public ICollection<int> ArraySizes => _arraySizes;
private void AddArrayString(string name)
{
@ -19,7 +20,7 @@ namespace Ryujinx.CustomTasks.SyntaxWalker
if (int.TryParse(rawArrayType.Substring(5), out int size))
{
ArraySizes.Add(size);
_arraySizes.Add(size);
}
}