protected override IDiffItem GenerateDiffItem(TypeDefinition oldElement, TypeDefinition newElement)
        {
            IEnumerable <IDiffItem> attributeDiffs = new CustomAttributeComparer().GetMultipleDifferences(oldElement.CustomAttributes, newElement.CustomAttributes);

            IEnumerable <IDiffItem> declarationDiffs =
                EnumerableExtensions.ConcatAll <IDiffItem>(
                    attributeDiffs,
                    CheckVisibility(oldElement, newElement)
                    );

            IEnumerable <IDiffItem> childrenDiffs =
                EnumerableExtensions.ConcatAll <IDiffItem>(
                    GetFieldDifferences(oldElement, newElement),
                    GetPropertyDifferences(oldElement, newElement),
                    GetMethodDifferences(oldElement, newElement),
                    GetEventDifferences(oldElement, newElement),
                    GetNestedTypeDiffs(oldElement, newElement)
                    );

            if (declarationDiffs.IsEmpty() && childrenDiffs.IsEmpty())
            {
                return(null);
            }
            return(new TypeDiffItem(oldElement, newElement, declarationDiffs, childrenDiffs.Cast <IMetadataDiffItem>()));
        }
        protected override IDiffItem GenerateDiffItem(ModuleDefinition oldElement, ModuleDefinition newElement)
        {
            IEnumerable <IDiffItem> declarationDiffs = EnumerableExtensions.ConcatAll <IDiffItem>(GetCustomAttributeDiffs(oldElement, newElement), GetReferenceDiffs(oldElement, newElement));
            IEnumerable <IDiffItem> childrenDiffs    = GetTypeDiffs(oldElement, newElement);

            if (declarationDiffs.IsEmpty() && childrenDiffs.IsEmpty())
            {
                return(null);
            }
            return(new ModuleDiffItem(oldElement, newElement, declarationDiffs, childrenDiffs.Cast <IMetadataDiffItem <TypeDefinition> >()));
        }
        protected override IDiffItem GenerateDiffItem(PropertyDefinition oldElement, PropertyDefinition newElement)
        {
            IEnumerable <IDiffItem> declarationDiffs =
                EnumerableExtensions.ConcatAll(
                    new CustomAttributeComparer().GetMultipleDifferences(oldElement.CustomAttributes, newElement.CustomAttributes),
                    GetReturnTypeDifference(oldElement, newElement)
                    );
            IEnumerable <IMetadataDiffItem <MethodDefinition> > childrenDiffs = GenerateAccessorDifferences(oldElement, newElement);

            if (declarationDiffs.IsEmpty() && childrenDiffs.IsEmpty())
            {
                return(null);
            }

            return(new PropertyDiffItem(oldElement, newElement, declarationDiffs, childrenDiffs));
        }
        protected override IDiffItem GenerateDiffItem(FieldDefinition oldElement, FieldDefinition newElement)
        {
            IEnumerable <IDiffItem> attributeDiffs = new CustomAttributeComparer().GetMultipleDifferences(oldElement.CustomAttributes, newElement.CustomAttributes);
            IEnumerable <IDiffItem> fieldTypeDiffs = GetFieldTypeDiff(oldElement, newElement);

            IEnumerable <IDiffItem> declarationDiffs =
                EnumerableExtensions.ConcatAll(
                    attributeDiffs,
                    CheckVisibility(oldElement, newElement),
                    CheckStaticFlag(oldElement, newElement),
                    fieldTypeDiffs
                    );

            if (declarationDiffs.IsEmpty())
            {
                return(null);
            }
            return(new FieldDiffItem(oldElement, newElement, declarationDiffs));
        }
Example #5
0
        private IEnumerable <IDiffItem> GetDeclarationDiffsChecked(MethodDefinition oldMethod, MethodDefinition newMethod)
        {
            IEnumerable <IDiffItem> attributeDifferences     = new CustomAttributeComparer().GetMultipleDifferences(oldMethod.CustomAttributes, newMethod.CustomAttributes);
            IEnumerable <IDiffItem> reducedVisibilityDiff    = CheckVisibility(oldMethod, newMethod);
            IEnumerable <IDiffItem> virtualFlagDiff          = CheckVirtualFlag(oldMethod, newMethod);
            IEnumerable <IDiffItem> staticFlagDiff           = CheckStaticFlag(oldMethod, newMethod);
            IEnumerable <IDiffItem> returnTypeDiff           = GetReturnTypeDifference(oldMethod, newMethod);
            IEnumerable <IDiffItem> parameterNameDifferences = GetParameterNameDiffs(oldMethod, newMethod);

            IEnumerable <IDiffItem> declarationDiffs =
                EnumerableExtensions.ConcatAll(
                    attributeDifferences,
                    reducedVisibilityDiff,
                    virtualFlagDiff,
                    staticFlagDiff,
                    returnTypeDiff,
                    parameterNameDifferences
                    );

            return(declarationDiffs);
        }