Introduce a cache for generic type instantiations.
Also add MakeGenericType, which creates type instances from a generic type definition and arguments. We will use this later to build properly fleshed out concrete generic types.
This commit is contained in:
@@ -94,7 +94,8 @@ namespace Il2CppInspector.Reflection
|
||||
if (!TypesByMethodSpecClassIndex.ContainsKey(spec.classIndexIndex)) {
|
||||
var genericTypeDefinition = MethodsByDefinitionIndex[spec.methodDefinitionIndex].DeclaringType;
|
||||
var genericInstance = Package.GenericInstances[spec.classIndexIndex];
|
||||
TypesByMethodSpecClassIndex.Add(spec.classIndexIndex, new TypeInfo(genericTypeDefinition, genericInstance));
|
||||
var genericArguments = ResolveGenericArguments(genericInstance);
|
||||
TypesByMethodSpecClassIndex.Add(spec.classIndexIndex, genericTypeDefinition.MakeGenericType(genericArguments));
|
||||
}
|
||||
|
||||
declaringType = TypesByMethodSpecClassIndex[spec.classIndexIndex];
|
||||
|
||||
Reference in New Issue
Block a user