예제 #1
0
        /// <summary>
        /// Creates a procedure type with resolved arguments.
        /// </summary>
        /// <param name="baseTypeName">Name of the resolved base type.</param>
        /// <param name="baseType">The base type.</param>
        /// <param name="resolvedBaseType">The resolved base type.</param>
        /// <param name="overloadList">The list of resolved overloads.</param>
        /// <param name="resolvedTypeName">The type name upon return.</param>
        /// <param name="resolvedType">The type upon return.</param>
        public static void BuildType(ITypeName baseTypeName, IObjectType baseType, ICompiledTypeWithFeature resolvedBaseType, IList <ICommandOverloadType> overloadList, out ITypeName resolvedTypeName, out IProcedureType resolvedType)
        {
            IProcedureType ResolvedProcedureType = new ProcedureType(baseTypeName, baseType, resolvedBaseType, overloadList);

            resolvedTypeName = new TypeName(ResolvedProcedureType.TypeFriendlyName);
            resolvedType     = ResolvedProcedureType;
        }
예제 #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(ICompiledType type1, ICompiledType type2)
        {
            bool Result = false;

            if (type1.GetType() == type2.GetType())
            {
                bool IsHandled = false;

                switch (type1)
                {
                case IFormalGenericType AsFormalGenericType:
                    Result    = FormalGenericType.TypesHaveIdenticalSignature((IFormalGenericType)type1, (IFormalGenericType)type2);
                    IsHandled = true;
                    break;

                case IClassType AsClassType:
                    Result    = ClassType.TypesHaveIdenticalSignature((IClassType)type1, (IClassType)type2);
                    IsHandled = true;
                    break;

                case IFunctionType AsFunctionType:
                    Result    = FunctionType.TypesHaveIdenticalSignature((IFunctionType)type1, (IFunctionType)type2);
                    IsHandled = true;
                    break;

                case IProcedureType AsProcedureType:
                    Result    = ProcedureType.TypesHaveIdenticalSignature((IProcedureType)type1, (IProcedureType)type2);
                    IsHandled = true;
                    break;

                case IPropertyType AsPropertyType:
                    Result    = PropertyType.TypesHaveIdenticalSignature((IPropertyType)type1, (IPropertyType)type2);
                    IsHandled = true;
                    break;

                case IIndexerType AsIndexerType:
                    Result    = IndexerType.TypesHaveIdenticalSignature((IIndexerType)type1, (IIndexerType)type2);
                    IsHandled = true;
                    break;

                case ITupleType AsTupleType:
                    Result    = TupleType.TypesHaveIdenticalSignature((ITupleType)type1, (ITupleType)type2);
                    IsHandled = true;
                    break;
                }

                Debug.Assert(IsHandled);
            }

            return(Result);
        }