private static ICollection<TypeReference> GetAttributeNamedArgsUsedTypes(TypeDefinition attributeType, Collection<CustomAttributeNamedArgument> namedArguments, bool fields) { V_0 = new List<TypeReference>(); V_1 = 0; while (V_1 < namedArguments.get_Count()) { if (attributeType != null) { if (fields) { stackVariable19 = attributeType.get_Fields(); } else { stackVariable19 = attributeType.get_Properties(); } V_2 = null; V_3 = stackVariable19; V_4 = attributeType; do { V_2 = Utilities.FindMemberArgumentRefersTo(V_3, namedArguments.get_Item(V_1)); if (V_4.get_BaseType() == null) { break; } V_4 = V_4.get_BaseType().Resolve(); if (V_4 == null) { break; } if (fields) { stackVariable40 = V_4.get_Fields(); } else { stackVariable40 = V_4.get_Properties(); } V_3 = stackVariable40; } while (V_2 == null); if (V_2 != null) { V_0.Add(V_2.get_DeclaringType()); } } V_6 = namedArguments.get_Item(V_1); V_0.AddRange(AttributesUtilities.GetAttributeArgumentValueUsedTypes(V_6.get_Argument())); V_1 = V_1 + 1; } return V_0; }
private static ICollection <TypeReference> GetAttributeNamedArgsUsedTypes(TypeDefinition attributeType, Collection <CustomAttributeNamedArgument> namedArguments, bool fields) { List <TypeReference> usedTypes = new List <TypeReference>(); for (int propertyIndex = 0; propertyIndex < namedArguments.Count; propertyIndex++) { if (attributeType != null) { IList fieldsOrProperties = fields ? (IList)attributeType.Fields : (IList)attributeType.Properties; MemberReference memberArgumentRefersTo = null; IList currentFieldsOrProperties = fieldsOrProperties; TypeDefinition currentTypeInInheritanceChain = attributeType; do { memberArgumentRefersTo = Utilities.FindMemberArgumentRefersTo(currentFieldsOrProperties, namedArguments[propertyIndex]); if (currentTypeInInheritanceChain.BaseType != null) { currentTypeInInheritanceChain = currentTypeInInheritanceChain.BaseType.Resolve(); if (currentTypeInInheritanceChain == null) { break; } currentFieldsOrProperties = fields ? (IList)currentTypeInInheritanceChain.Fields : (IList)currentTypeInInheritanceChain.Properties; } else { break; } }while (memberArgumentRefersTo == null); if (memberArgumentRefersTo != null) { usedTypes.Add(memberArgumentRefersTo.DeclaringType); } } usedTypes.AddRange(GetAttributeArgumentValueUsedTypes(namedArguments[propertyIndex].Argument)); } return(usedTypes); }