Model: Simplify SelectMany() queries
This commit is contained in:
@@ -480,7 +480,7 @@ namespace Il2CppInspector.Reflection {
|
|||||||
var refs = new HashSet<TypeInfo>();
|
var refs = new HashSet<TypeInfo>();
|
||||||
|
|
||||||
// Constructor, event, field, method, nested type, property attributes
|
// Constructor, event, field, method, nested type, property attributes
|
||||||
var attrs = DeclaredMembers.Select(m => m.CustomAttributes).SelectMany(a => a);
|
var attrs = DeclaredMembers.SelectMany(m => m.CustomAttributes);
|
||||||
refs.UnionWith(attrs.Select(a => a.AttributeType));
|
refs.UnionWith(attrs.Select(a => a.AttributeType));
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
@@ -494,20 +494,20 @@ namespace Il2CppInspector.Reflection {
|
|||||||
|
|
||||||
// Nested types
|
// Nested types
|
||||||
refs.UnionWith(DeclaredNestedTypes);
|
refs.UnionWith(DeclaredNestedTypes);
|
||||||
refs.UnionWith(DeclaredNestedTypes.Select(n => n.GetAllTypeReferences()).SelectMany(t => t));
|
refs.UnionWith(DeclaredNestedTypes.SelectMany(n => n.GetAllTypeReferences()));
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
refs.UnionWith(DeclaredConstructors.Select(m => m.DeclaredParameters).SelectMany(p => p).Select(p => p.ParameterType));
|
refs.UnionWith(DeclaredConstructors.SelectMany(m => m.DeclaredParameters).Select(p => p.ParameterType));
|
||||||
|
|
||||||
// Methods (includes event add/remove/raise, property get/set methods and extension methods)
|
// Methods (includes event add/remove/raise, property get/set methods and extension methods)
|
||||||
refs.UnionWith(DeclaredMethods.Select(m => m.ReturnParameter.ParameterType));
|
refs.UnionWith(DeclaredMethods.Select(m => m.ReturnParameter.ParameterType));
|
||||||
refs.UnionWith(DeclaredMethods.Select(m => m.DeclaredParameters).SelectMany(p => p).Select(p => p.ParameterType));
|
refs.UnionWith(DeclaredMethods.SelectMany(m => m.DeclaredParameters).Select(p => p.ParameterType));
|
||||||
|
|
||||||
// Method generic type parameters and constraints
|
// Method generic type parameters and constraints
|
||||||
// TODO: Needs to recurse through nested generic parameters
|
// TODO: Needs to recurse through nested generic parameters
|
||||||
refs.UnionWith(DeclaredMethods.Select(m => m.GenericTypeParameters ?? new List<TypeInfo>()).SelectMany(p => p));
|
refs.UnionWith(DeclaredMethods.SelectMany(m => m.GenericTypeParameters ?? new List<TypeInfo>()));
|
||||||
refs.UnionWith(DeclaredMethods.Select(m => m.GenericTypeParameters ?? new List<TypeInfo>()).SelectMany(p => p)
|
refs.UnionWith(DeclaredMethods.SelectMany(m => m.GenericTypeParameters ?? new List<TypeInfo>())
|
||||||
.Select(p => p.GetGenericParameterConstraints()).SelectMany(c => c));
|
.SelectMany(p => p.GetGenericParameterConstraints()));
|
||||||
|
|
||||||
// Type declaration attributes
|
// Type declaration attributes
|
||||||
refs.UnionWith(CustomAttributes.Select(a => a.AttributeType));
|
refs.UnionWith(CustomAttributes.Select(a => a.AttributeType));
|
||||||
|
|||||||
Reference in New Issue
Block a user