Model: Fix ContainsGenericParameters behaviour for element types etc.

This commit is contained in:
Katy Coe
2020-01-30 06:32:31 +01:00
parent a640d866ae
commit 9220799d56

View File

@@ -32,7 +32,7 @@ namespace Il2CppInspector.Reflection {
: null; : null;
// True if the type contains unresolved generic type parameters // True if the type contains unresolved generic type parameters
public bool ContainsGenericParameters { get; } public bool ContainsGenericParameters => IsGenericParameter || genericArguments.Any(ga => ga.ContainsGenericParameters);
public string BaseName => base.Name; public string BaseName => base.Name;
@@ -459,7 +459,6 @@ namespace Il2CppInspector.Reflection {
if (Definition.genericContainerIndex >= 0) { if (Definition.genericContainerIndex >= 0) {
IsGenericType = true; IsGenericType = true;
IsGenericParameter = false; IsGenericParameter = false;
ContainsGenericParameters = true;
// Store the generic type parameters for later instantiation // Store the generic type parameters for later instantiation
var container = pkg.GenericContainers[Definition.genericContainerIndex]; var container = pkg.GenericContainers[Definition.genericContainerIndex];
@@ -603,7 +602,6 @@ namespace Il2CppInspector.Reflection {
IsGenericType = true; IsGenericType = true;
IsGenericParameter = false; IsGenericParameter = false;
ContainsGenericParameters = true;
// Get the instantiation // Get the instantiation
var genericInstance = image.ReadMappedObject<Il2CppGenericInst>(generic.context.class_inst); var genericInstance = image.ReadMappedObject<Il2CppGenericInst>(generic.context.class_inst);
@@ -630,7 +628,6 @@ namespace Il2CppInspector.Reflection {
Assembly = ElementType.Assembly; Assembly = ElementType.Assembly;
Namespace = ElementType.Namespace; Namespace = ElementType.Namespace;
Name = ElementType.Name; Name = ElementType.Name;
ContainsGenericParameters = ElementType.ContainsGenericParameters;
IsArray = true; IsArray = true;
arrayRank = descriptor.rank; arrayRank = descriptor.rank;
@@ -643,7 +640,6 @@ namespace Il2CppInspector.Reflection {
Assembly = ElementType.Assembly; Assembly = ElementType.Assembly;
Namespace = ElementType.Namespace; Namespace = ElementType.Namespace;
Name = ElementType.Name; Name = ElementType.Name;
ContainsGenericParameters = ElementType.ContainsGenericParameters;
IsPointer = (pType.type == Il2CppTypeEnum.IL2CPP_TYPE_PTR); IsPointer = (pType.type == Il2CppTypeEnum.IL2CPP_TYPE_PTR);
IsArray = !IsPointer; IsArray = !IsPointer;
@@ -683,7 +679,6 @@ namespace Il2CppInspector.Reflection {
GenericParameterPosition = paramType.num; GenericParameterPosition = paramType.num;
IsGenericParameter = true; IsGenericParameter = true;
ContainsGenericParameters = true;
IsGenericType = false; IsGenericType = false;
} }
} }
@@ -716,7 +711,6 @@ namespace Il2CppInspector.Reflection {
IsGenericParameter = true; IsGenericParameter = true;
IsGenericType = false; IsGenericType = false;
ContainsGenericParameters = true;
} }
// Initialize a type that is a generic parameter of a generic method // Initialize a type that is a generic parameter of a generic method