private static List <BreakingChangeBase> CompareAssemblies(AssemblyData oldAssembly, AssemblyData newAssembly, AssemblyFamily newFamily) { var breakingChanges = new List <BreakingChangeBase>(); foreach (var oldType in oldAssembly.GetNonNestedTypeDefinitions()) { var newType = oldType.GetEquivalentNewType(newFamily); if (newType == null) { breakingChanges.Add(new RemovedRootType(oldType)); } else { breakingChanges.AddRange(MetadataComparer.CompareTypes(oldType, newType, newFamily)); } } return(breakingChanges); }
private static IEnumerable <BreakingChangeBase> CompareMembers(MemberDataBase oldMember, MemberDataBase newMember, AssemblyFamily newAssemblyFamily) { switch (oldMember.MetadataItemKind) { case MetadataItemKinds.Constant: case MetadataItemKinds.Event: case MetadataItemKinds.Field: case MetadataItemKinds.Property: return(MetadataComparer.CompareItems(oldMember, newMember, newAssemblyFamily)); case MetadataItemKinds.Indexer: return(MetadataComparer.CompareIndexers((IndexerData)oldMember, (IndexerData)newMember, newAssemblyFamily)); case MetadataItemKinds.Constructor: case MetadataItemKinds.Operator: { var breakingChanges = MetadataComparer.CompareItems(oldMember, newMember, newAssemblyFamily); MetadataComparer.CompareParameters((IParameterizedItem)oldMember, (IParameterizedItem)newMember, newAssemblyFamily, breakingChanges); return(breakingChanges); } case MetadataItemKinds.Method: return(MetadataComparer.CompareMethods((MethodData)oldMember, (MethodData)newMember, newAssemblyFamily)); case MetadataItemKinds.TypeDefinition: return(MetadataComparer.CompareTypes((TypeDefinitionData)oldMember, (TypeDefinitionData)newMember, newAssemblyFamily)); case MetadataItemKinds.Assembly: case MetadataItemKinds.GenericTypeParameter: case MetadataItemKinds.Parameter: Debug.Fail("This is not a member: " + oldMember.MetadataItemKind); break; default: Debug.Fail("Unknown MetadataItemKinds: " + oldMember.MetadataItemKind); break; } return(_noBreakingChanges); }
/// <summary> /// Compares two associated <see cref="TypeData"/> instances and returns the breaking changes introduced in the newer version of the /// type. /// </summary> public static List <BreakingChangeBase> CompareTypes(TypeData oldTypeBase, TypeData newTypeBase) { return(MetadataComparer.CompareTypes(oldTypeBase, newTypeBase, newTypeBase.GetDefiningAssemblyFamily())); }