properly fix scoped name for generic arrays

This commit is contained in:
LukeFZ
2024-02-27 17:34:24 +01:00
parent 1e27f8672d
commit b21b6e89ab
2 changed files with 9 additions and 11 deletions

View File

@@ -10,11 +10,11 @@
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance> <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Version>2023.1</Version> <Version>2023.1</Version>
<Company>Noisy Cow Studios</Company> <Company>LukeFZ, Noisy Cow Studios</Company>
<Product>Il2CppInspector Command-Line Edition</Product> <Product>Il2CppInspectorRedux Command-Line Edition</Product>
<Copyright>(c) 2017-2021 Katy Coe - www.djkaty.com - www.github.com/djkaty</Copyright> <Copyright>(c) 2023-2024 LukeFZ - https://github.com/LukeFZ, original (c) 2017-2021 Katy Coe - www.djkaty.com - www.github.com/djkaty</Copyright>
<PackageId>Il2CppInspector.CLI</PackageId> <PackageId>Il2CppInspectorRedux.CLI</PackageId>
<Authors>Katy Coe</Authors> <Authors>LukeFZ, Katy Coe</Authors>
<AssemblyName>Il2CppInspector</AssemblyName> <AssemblyName>Il2CppInspector</AssemblyName>
</PropertyGroup> </PropertyGroup>

View File

@@ -414,10 +414,6 @@ namespace Il2CppInspector.Reflection
// Returns the minimally qualified type name required to refer to this type within the specified scope // Returns the minimally qualified type name required to refer to this type within the specified scope
private string getScopedFullName(Scope scope) private string getScopedFullName(Scope scope)
{ {
// Generic type parameters take precedence over all other names, so if FullName is null (== generic) we can just return the name itself
if (FullName == null)
return this.Name;
// This is the type to be used (generic type parameters have a null FullName) // This is the type to be used (generic type parameters have a null FullName)
var usedType = FullName.Replace('+', '.'); var usedType = FullName.Replace('+', '.');
@@ -581,8 +577,8 @@ namespace Il2CppInspector.Reflection
if (usingScope == null) if (usingScope == null)
return CSharpName; return CSharpName;
// Generic parameters don't have a scope // Generic parameters (or generic arrays) don't have a scope
if (IsGenericParameter) if (HasNoScope)
return CSharpName; return CSharpName;
var s = Namespace + "." + base.Name; var s = Namespace + "." + base.Name;
@@ -716,6 +712,8 @@ namespace Il2CppInspector.Reflection
// Helper function for determining if using this type as a field, parameter etc. requires that field or method to be declared as unsafe // Helper function for determining if using this type as a field, parameter etc. requires that field or method to be declared as unsafe
public bool RequiresUnsafeContext => IsPointer || (HasElementType && ElementType.RequiresUnsafeContext); public bool RequiresUnsafeContext => IsPointer || (HasElementType && ElementType.RequiresUnsafeContext);
public bool HasNoScope => IsGenericParameter || (HasElementType && ElementType.HasNoScope);
// May get overridden by Il2CppType-based constructor below // May get overridden by Il2CppType-based constructor below
public override MemberTypes MemberType { get; } = MemberTypes.TypeInfo; public override MemberTypes MemberType { get; } = MemberTypes.TypeInfo;