Esempio n. 1
0
        /// <summary>
        /// Compares two overloads.
        /// </summary>
        /// <param name="overload1">The first overload.</param>
        /// <param name="overload2">The second overload.</param>
        public static bool CommandOverloadsHaveIdenticalSignature(ICommandOverloadType overload1, ICommandOverloadType overload2)
        {
            bool IsIdentical = true;

            IsIdentical &= overload1.ParameterList.Count == overload2.ParameterList.Count;
            IsIdentical &= overload1.ParameterEnd == overload2.ParameterEnd;

            for (int i = 0; i < overload1.ParameterList.Count && i < overload2.ParameterList.Count; i++)
            {
                Debug.Assert(overload1.ParameterList[i].ValidEntity.IsAssigned);
                Debug.Assert(overload1.ParameterList[i].ValidEntity.Item.ResolvedEffectiveType.IsAssigned);
                Debug.Assert(overload2.ParameterList[i].ValidEntity.IsAssigned);
                Debug.Assert(overload2.ParameterList[i].ValidEntity.Item.ResolvedEffectiveType.IsAssigned);

                ICompiledType Type1 = overload1.ParameterList[i].ValidEntity.Item.ResolvedEffectiveType.Item;
                ICompiledType Type2 = overload2.ParameterList[i].ValidEntity.Item.ResolvedEffectiveType.Item;

                IsIdentical &= ObjectType.TypesHaveIdenticalSignature(Type1, Type2);
            }

            IsIdentical &= Assertion.IsAssertionListEqual(overload1.RequireList, overload2.RequireList);
            IsIdentical &= Assertion.IsAssertionListEqual(overload1.EnsureList, overload2.EnsureList);
            IsIdentical &= ExceptionHandler.IdenticalExceptionSignature(overload1.ExceptionIdentifierList, overload2.ExceptionIdentifierList);

            return(IsIdentical);
        }
Esempio n. 2
0
        /// <summary>
        /// Compares two types.
        /// </summary>
        /// <param name="type1">The first type.</param>
        /// <param name="type2">The second type.</param>
        public static bool TypesHaveIdenticalSignature(IIndexerType type1, IIndexerType type2)
        {
            bool IsIdentical = true;

            IsIdentical &= ObjectType.TypesHaveIdenticalSignature(type1.ResolvedBaseType.Item, type2.ResolvedBaseType.Item);
            IsIdentical &= ObjectType.TypesHaveIdenticalSignature(type1.ResolvedEntityType.Item, type2.ResolvedEntityType.Item);
            IsIdentical &= type1.IndexerKind == type2.IndexerKind;
            IsIdentical &= type1.IndexParameterList.Count == type2.IndexParameterList.Count;
            IsIdentical &= type1.ParameterEnd == type2.ParameterEnd;

            for (int i = 0; i < type1.IndexParameterList.Count && i < type2.IndexParameterList.Count; i++)
            {
                Debug.Assert(type1.IndexParameterList[i].ValidEntity.IsAssigned);
                Debug.Assert(type1.IndexParameterList[i].ValidEntity.Item.ResolvedEffectiveType.IsAssigned);
                Debug.Assert(type2.IndexParameterList[i].ValidEntity.IsAssigned);
                Debug.Assert(type2.IndexParameterList[i].ValidEntity.Item.ResolvedEffectiveType.IsAssigned);
                IsIdentical &= ObjectType.TypesHaveIdenticalSignature(type1.IndexParameterList[i].ValidEntity.Item.ResolvedEffectiveType.Item, type2.IndexParameterList[i].ValidEntity.Item.ResolvedEffectiveType.Item);
            }

            IsIdentical &= Assertion.IsAssertionListEqual(type1.GetRequireList, type2.GetRequireList);
            IsIdentical &= Assertion.IsAssertionListEqual(type1.GetEnsureList, type2.GetEnsureList);
            IsIdentical &= ExceptionHandler.IdenticalExceptionSignature(type1.GetExceptionIdentifierList, type2.GetExceptionIdentifierList);
            IsIdentical &= Assertion.IsAssertionListEqual(type1.SetRequireList, type2.SetRequireList);
            IsIdentical &= Assertion.IsAssertionListEqual(type1.SetEnsureList, type2.SetEnsureList);
            IsIdentical &= ExceptionHandler.IdenticalExceptionSignature(type1.SetExceptionIdentifierList, type2.SetExceptionIdentifierList);

            return(IsIdentical);
        }
Esempio n. 3
0
        /// <summary>
        /// Compares two types.
        /// </summary>
        /// <param name="type1">The first type.</param>
        /// <param name="type2">The second type.</param>
        public static bool TypesHaveIdenticalSignature(IClassType type1, IClassType type2)
        {
            bool IsIdentical = true;

            IsIdentical &= type1.BaseClass == type2.BaseClass;
            IsIdentical &= type1.TypeArgumentTable.Count == type2.TypeArgumentTable.Count;

            IList <ICompiledType> TypeArgumentList1 = new List <ICompiledType>();
            IList <ICompiledType> TypeArgumentList2 = new List <ICompiledType>();

            foreach (KeyValuePair <string, ICompiledType> Entry in type1.TypeArgumentTable)
            {
                ICompiledType TypeArgument = Entry.Value;
                TypeArgumentList1.Add(TypeArgument);
            }

            foreach (KeyValuePair <string, ICompiledType> Entry in type2.TypeArgumentTable)
            {
                ICompiledType TypeArgument = Entry.Value;
                TypeArgumentList2.Add(TypeArgument);
            }

            for (int i = 0; i < TypeArgumentList1.Count && i < TypeArgumentList2.Count; i++)
            {
                IsIdentical &= ObjectType.TypesHaveIdenticalSignature(TypeArgumentList1[i], TypeArgumentList2[i]);
            }

            return(IsIdentical);
        }
Esempio n. 4
0
        /// <summary>
        /// Compares two types.
        /// </summary>
        /// <param name="type1">The first type.</param>
        /// <param name="type2">The second type.</param>
        public static bool TypesHaveIdenticalSignature(IPropertyType type1, IPropertyType type2)
        {
            bool IsIdentical = true;

            IsIdentical &= ObjectType.TypesHaveIdenticalSignature(type1.ResolvedBaseType.Item, type2.ResolvedBaseType.Item);
            IsIdentical &= ObjectType.TypesHaveIdenticalSignature(type1.ResolvedEntityType.Item, type2.ResolvedEntityType.Item);
            IsIdentical &= type1.PropertyKind == type2.PropertyKind;
            IsIdentical &= Assertion.IsAssertionListEqual(type1.GetEnsureList, type2.GetEnsureList);
            IsIdentical &= ExceptionHandler.IdenticalExceptionSignature(type1.GetExceptionIdentifierList, type2.GetExceptionIdentifierList);
            IsIdentical &= Assertion.IsAssertionListEqual(type1.SetRequireList, type2.SetRequireList);
            IsIdentical &= ExceptionHandler.IdenticalExceptionSignature(type1.SetExceptionIdentifierList, type2.SetExceptionIdentifierList);

            return(IsIdentical);
        }
Esempio n. 5
0
        /// <summary>
        /// Compares two types.
        /// </summary>
        /// <param name="type1">The first type.</param>
        /// <param name="type2">The second type.</param>
        public static bool TypesHaveIdenticalSignature(ITupleType type1, ITupleType type2)
        {
            bool IsIdentical = true;

            for (int i = 0; i < type1.EntityDeclarationList.Count && i < type2.EntityDeclarationList.Count; i++)
            {
                Debug.Assert(type1.EntityDeclarationList[i].ValidEntity.IsAssigned);
                Debug.Assert(type1.EntityDeclarationList[i].ValidEntity.Item.ResolvedEffectiveType.IsAssigned);
                Debug.Assert(type2.EntityDeclarationList[i].ValidEntity.IsAssigned);
                Debug.Assert(type2.EntityDeclarationList[i].ValidEntity.Item.ResolvedEffectiveType.IsAssigned);
                IsIdentical &= ObjectType.TypesHaveIdenticalSignature(type1.EntityDeclarationList[i].ValidEntity.Item.ResolvedEffectiveType.Item, type2.EntityDeclarationList[i].ValidEntity.Item.ResolvedEffectiveType.Item);
            }

            return(IsIdentical);
        }
Esempio n. 6
0
        /// <summary>
        /// Compares two types.
        /// </summary>
        /// <param name="type1">The first type.</param>
        /// <param name="type2">The second type.</param>
        public static bool TypesHaveIdenticalSignature(IProcedureType type1, IProcedureType type2)
        {
            bool IsIdentical = true;

            IsIdentical &= ObjectType.TypesHaveIdenticalSignature(type1.ResolvedBaseType.Item, type2.ResolvedBaseType.Item);
            IsIdentical &= type1.OverloadList.Count == type2.OverloadList.Count;

            foreach (ICommandOverloadType Overload1 in type1.OverloadList)
            {
                bool MatchingOverload = false;

                foreach (ICommandOverloadType Overload2 in type2.OverloadList)
                {
                    MatchingOverload |= CommandOverloadType.CommandOverloadsHaveIdenticalSignature(Overload1, Overload2);
                }

                IsIdentical &= MatchingOverload;
            }

            return(IsIdentical);
        }