コード例 #1
0
        // TODO: Add support for property parameter lists
        public override DifferenceType Diff(IDifferences differences, MemberMapping mapping)
        {
            IMethodDefinition method1 = mapping[0] as IMethodDefinition;
            IMethodDefinition method2 = mapping[1] as IMethodDefinition;

            if (method1 == null && method2 == null)
            {
                return(DifferenceType.Unknown);
            }

            if (method1 != null && method2 != null)
            {
                return(DifferenceType.Unknown);
            }

            if (method1 != null)
            {
                IMethodDefinition match = FindBestMatch(method1, mapping.ContainingType, 1, 0);

                if (match != null)
                {
                    differences.AddIncompatibleDifference(this,
                                                          "Cannot change parameter types for method {0} and {1}", method1.GetMethodSignature(), match.GetMethodSignature());
                    return(DifferenceType.Changed);
                }
            }

            if (method2 != null)
            {
                IMethodDefinition match = FindBestMatch(method2, mapping.ContainingType, 0, 1);

                if (match != null)
                {
                    differences.AddIncompatibleDifference(this,
                                                          "Cannot change parameter types for method {0} and {1}", method2.GetMethodSignature(), match.GetMethodSignature());
                    return(DifferenceType.Changed);
                }
            }

            return(DifferenceType.Unknown);
        }