Only include GenericMethod definers in Types
Including *every* generated type in Types defeats the purpose of the Types property, which is to list all types directly referred to by the Il2Cpp metadata. Therefore, we return to the previous implementation: only list types referred to by DefinitionIndex, ReferenceIndex, and classIndexIndex.
This commit is contained in:
@@ -32,13 +32,8 @@ namespace Il2CppInspector.Reflection
|
|||||||
public Dictionary<string, TypeInfo> TypesByFullName { get; } = new Dictionary<string, TypeInfo>();
|
public Dictionary<string, TypeInfo> TypesByFullName { get; } = new Dictionary<string, TypeInfo>();
|
||||||
|
|
||||||
// Every type
|
// Every type
|
||||||
public IEnumerable<TypeInfo> Types {
|
public IEnumerable<TypeInfo> Types => TypesByDefinitionIndex.Concat(TypesByReferenceIndex)
|
||||||
get {
|
.Concat(GenericMethods.Values.Select(m => m.DeclaringType)).Distinct();
|
||||||
var result = new IEnumerable<TypeInfo>[] { TypesByDefinitionIndex, TypesByReferenceIndex }.SelectMany(t => t);
|
|
||||||
result = result.Concat(result.SelectMany(t => t.CachedGeneratedTypes));
|
|
||||||
return result.Distinct();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// List of all methods ordered by their MethodDefinitionIndex
|
// List of all methods ordered by their MethodDefinitionIndex
|
||||||
public MethodBase[] MethodsByDefinitionIndex { get; }
|
public MethodBase[] MethodsByDefinitionIndex { get; }
|
||||||
|
|||||||
@@ -37,19 +37,6 @@ namespace Il2CppInspector.Reflection {
|
|||||||
private Dictionary<int, TypeInfo> generatedArrayTypes = new Dictionary<int, TypeInfo>();
|
private Dictionary<int, TypeInfo> generatedArrayTypes = new Dictionary<int, TypeInfo>();
|
||||||
private TypeInfo generatedByRefType;
|
private TypeInfo generatedByRefType;
|
||||||
private TypeInfo generatedPointerType;
|
private TypeInfo generatedPointerType;
|
||||||
// This property exposes all types which have been generated directly from this one.
|
|
||||||
public IEnumerable<TypeInfo> CachedGeneratedTypes {
|
|
||||||
get {
|
|
||||||
IEnumerable<TypeInfo> result = generatedArrayTypes.Values;
|
|
||||||
if (genericTypeInstances != null)
|
|
||||||
result = result.Concat(genericTypeInstances.Values);
|
|
||||||
if (generatedByRefType != null)
|
|
||||||
result = result.Append(generatedByRefType);
|
|
||||||
if (generatedPointerType != null)
|
|
||||||
result = result.Append(generatedPointerType);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Information/flags about the type
|
// Information/flags about the type
|
||||||
// Undefined if the Type represents a generic type parameter
|
// Undefined if the Type represents a generic type parameter
|
||||||
|
|||||||
Reference in New Issue
Block a user