aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Horizon.Kernel.Generators/Kernel/SyscallSyntaxReceiver.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Horizon.Kernel.Generators/Kernel/SyscallSyntaxReceiver.cs')
-rw-r--r--Ryujinx.Horizon.Kernel.Generators/Kernel/SyscallSyntaxReceiver.cs45
1 files changed, 22 insertions, 23 deletions
diff --git a/Ryujinx.Horizon.Kernel.Generators/Kernel/SyscallSyntaxReceiver.cs b/Ryujinx.Horizon.Kernel.Generators/Kernel/SyscallSyntaxReceiver.cs
index e2e8e1d3..e480a859 100644
--- a/Ryujinx.Horizon.Kernel.Generators/Kernel/SyscallSyntaxReceiver.cs
+++ b/Ryujinx.Horizon.Kernel.Generators/Kernel/SyscallSyntaxReceiver.cs
@@ -16,38 +16,37 @@ namespace Ryujinx.Horizon.Generators.Kernel
public void OnVisitSyntaxNode(SyntaxNode syntaxNode)
{
- if (syntaxNode is ClassDeclarationSyntax classDeclaration && classDeclaration.AttributeLists.Count != 0)
+ if (!(syntaxNode is ClassDeclarationSyntax classDeclaration) || classDeclaration.AttributeLists.Count == 0)
{
- foreach (var attributeList in classDeclaration.AttributeLists)
- {
- if (attributeList.Attributes.Any(x => x.Name.GetText().ToString() == "SvcImpl"))
- {
- foreach (var memberDeclaration in classDeclaration.Members)
- {
- if (memberDeclaration is MethodDeclarationSyntax methodDeclaration)
- {
- VisitMethod(methodDeclaration);
- }
- }
+ return;
+ }
+
+ if (!classDeclaration.AttributeLists.Any(attributeList =>
+ attributeList.Attributes.Any(x => x.Name.GetText().ToString() == "SvcImpl")))
+ {
+ return;
+ }
- break;
- }
+ foreach (var memberDeclaration in classDeclaration.Members)
+ {
+ if (memberDeclaration is MethodDeclarationSyntax methodDeclaration)
+ {
+ VisitMethod(methodDeclaration);
}
}
}
private void VisitMethod(MethodDeclarationSyntax methodDeclaration)
{
- if (methodDeclaration.AttributeLists.Count != 0)
+ if (methodDeclaration.AttributeLists.Count == 0)
{
- foreach (var attributeList in methodDeclaration.AttributeLists)
- {
- if (attributeList.Attributes.Any(x => x.Name.GetText().ToString() == "Svc"))
- {
- SvcImplementations.Add(methodDeclaration);
- break;
- }
- }
+ return;
+ }
+
+ if (methodDeclaration.AttributeLists.Any(attributeList =>
+ attributeList.Attributes.Any(x => x.Name.GetText().ToString() == "Svc")))
+ {
+ SvcImplementations.Add(methodDeclaration);
}
}
}