misc: chore: Use explicit types & fix object creation

This commit is contained in:
KeatonTheBot committed 2026-05-30 16:26:50 -05:00
1 parent 9d3fecf334
commit 76a123b81d
454 files changed
+3042 -2961

No files matched your search

@@ -63,7 +63,7 @@ namespace Ryujinx.Horizon.Generators.Hipc
if (syntaxReceiver != null)
{
foreach (var commandInterface in syntaxReceiver.CommandInterfaces)
foreach (CommandInterface commandInterface in syntaxReceiver.CommandInterfaces)
{
if (!NeedsIServiceObjectImplementation(context.Compilation, commandInterface.ClassDeclarationSyntax))
{
@@ -88,7 +88,7 @@ namespace Ryujinx.Horizon.Generators.Hipc
GenerateMethodTable(generator, context.Compilation, commandInterface);
foreach (var method in commandInterface.CommandImplementations)
foreach (MethodDeclarationSyntax method in commandInterface.CommandImplementations)
{
generator.AppendLine();
@@ -131,9 +131,9 @@ namespace Ryujinx.Horizon.Generators.Hipc
{
generator.EnterScope($"return FrozenDictionary.ToFrozenDictionary(new []");
foreach (var method in commandInterface.CommandImplementations)
foreach (MethodDeclarationSyntax method in commandInterface.CommandImplementations)
{
foreach (var commandId in GetAttributeArguments(compilation, method, TypeCommandAttribute, 0))
foreach (string commandId in GetAttributeArguments(compilation, method, TypeCommandAttribute, 0))
{
string[] args = new string[method.ParameterList.Parameters.Count];
@@ -145,7 +145,7 @@ namespace Ryujinx.Horizon.Generators.Hipc
{
int index = 0;
foreach (var parameter in method.ParameterList.Parameters)
foreach (ParameterSyntax parameter in method.ParameterList.Parameters)
{
string canonicalTypeName = GetCanonicalTypeNameWithGenericArguments(compilation, parameter.Type);
CommandArgType argType = GetCommandArgType(compilation, parameter);
@@ -197,7 +197,7 @@ namespace Ryujinx.Horizon.Generators.Hipc
if (symbol != null)
{
foreach (var attribute in symbol.GetAttributes())
foreach (AttributeData attribute in symbol.GetAttributes())
{
if (attribute.AttributeClass?.ToDisplayString() == attributeName &&
(uint)argIndex < (uint)attribute.ConstructorArguments.Length)
@@ -219,7 +219,7 @@ namespace Ryujinx.Horizon.Generators.Hipc
int outObjectsCount = 0;
int buffersCount = 0;
foreach (var parameter in method.ParameterList.Parameters)
foreach (ParameterSyntax parameter in method.ParameterList.Parameters)
{
if (IsObject(compilation, parameter))
{
@@ -293,7 +293,7 @@ namespace Ryujinx.Horizon.Generators.Hipc
int inMoveHandleIndex = 0;
int inObjectIndex = 0;
foreach (var parameter in method.ParameterList.Parameters)
foreach (ParameterSyntax parameter in method.ParameterList.Parameters)
{
string name = parameter.Identifier.Text;
string argName = GetPrefixedArgName(name);
@@ -776,9 +776,9 @@ namespace Ryujinx.Horizon.Generators.Hipc
private static bool HasAttribute(Compilation compilation, ParameterSyntax parameterSyntax, string fullAttributeName)
{
foreach (var attributeList in parameterSyntax.AttributeLists)
foreach (AttributeListSyntax attributeList in parameterSyntax.AttributeLists)
{
foreach (var attribute in attributeList.Attributes)
foreach (AttributeSyntax attribute in attributeList.Attributes)
{
if (GetCanonicalTypeName(compilation, attribute) == fullAttributeName)
{
@@ -793,8 +793,8 @@ namespace Ryujinx.Horizon.Generators.Hipc
private static bool NeedsIServiceObjectImplementation(Compilation compilation, ClassDeclarationSyntax classDeclarationSyntax)
{
ITypeSymbol type = compilation.GetSemanticModel(classDeclarationSyntax.SyntaxTree).GetDeclaredSymbol(classDeclarationSyntax);
var serviceObjectInterface = type?.AllInterfaces.FirstOrDefault(x => x.ToDisplayString() == TypeIServiceObject);
var interfaceMember = serviceObjectInterface?.GetMembers().FirstOrDefault(x => x.Name == "GetCommandHandlers");
INamedTypeSymbol serviceObjectInterface = type?.AllInterfaces.FirstOrDefault(x => x.ToDisplayString() == TypeIServiceObject);
ISymbol interfaceMember = serviceObjectInterface?.GetMembers().FirstOrDefault(x => x.Name == "GetCommandHandlers");
// Return true only if the class implements IServiceObject but does not actually implement the method
// that the interface defines, since this is the only case we want to handle, if the method already exists
@@ -26,7 +26,7 @@ namespace Ryujinx.Horizon.Generators.Hipc
CommandInterface commandInterface = new(classDeclaration);
foreach (var memberDeclaration in classDeclaration.Members)
foreach (MemberDeclarationSyntax memberDeclaration in classDeclaration.Members)
{
if (memberDeclaration is MethodDeclarationSyntax methodDeclaration)
{
@@ -44,7 +44,7 @@ namespace Ryujinx.Horizon.Generators.Hipc
if (methodDeclaration.AttributeLists.Count != 0)
{
foreach (var attributeList in methodDeclaration.AttributeLists)
foreach (AttributeListSyntax attributeList in methodDeclaration.AttributeLists)
{
if (attributeList.Attributes.Any(x => x.Name.ToString().Contains(attributeName)))
{