mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2025-06-29 23:10:47 -07:00
[Ryujinx.Horizon.Kernel.Generators] Address dotnet-format issues (#5376)
* Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * Run dotnet format pass * Remove left-over files and adjust namespaces * Fix alignment
This commit is contained in:
@ -0,0 +1,53 @@
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Ryujinx.Horizon.Kernel.Generators
|
||||
{
|
||||
class SyscallSyntaxReceiver : ISyntaxReceiver
|
||||
{
|
||||
public List<MethodDeclarationSyntax> SvcImplementations { get; }
|
||||
|
||||
public SyscallSyntaxReceiver()
|
||||
{
|
||||
SvcImplementations = new List<MethodDeclarationSyntax>();
|
||||
}
|
||||
|
||||
public void OnVisitSyntaxNode(SyntaxNode syntaxNode)
|
||||
{
|
||||
if (!(syntaxNode is ClassDeclarationSyntax classDeclaration) || classDeclaration.AttributeLists.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!classDeclaration.AttributeLists.Any(attributeList =>
|
||||
attributeList.Attributes.Any(x => x.Name.GetText().ToString() == "SvcImpl")))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var memberDeclaration in classDeclaration.Members)
|
||||
{
|
||||
if (memberDeclaration is MethodDeclarationSyntax methodDeclaration)
|
||||
{
|
||||
VisitMethod(methodDeclaration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void VisitMethod(MethodDeclarationSyntax methodDeclaration)
|
||||
{
|
||||
if (methodDeclaration.AttributeLists.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (methodDeclaration.AttributeLists.Any(attributeList =>
|
||||
attributeList.Attributes.Any(x => x.Name.GetText().ToString() == "Svc")))
|
||||
{
|
||||
SvcImplementations.Add(methodDeclaration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user