Exemple #1
0
        public static object create_array(
            int n,
            RT_TYPE a_type,
            EIFFEL_TYPE_INFO a_current,
            RuntimeTypeHandle any_type_handle
            )
        // Create new instance of an array type whose element types are `a_type' in context of
        // `a_current' object.
        // Handles elements that are class types as well as formals.
        {
            RT_CLASS_TYPE type_to_create;

            // Evaluate type in context of Current object.
            type_to_create = (RT_CLASS_TYPE)a_type.evaluated_type(a_current.____type());

            if (type_to_create.is_none() || (type_to_create.type.Value == any_type_handle.Value))
            {
                return(new object [n]);
            }
            else
            {
                return(Array.CreateInstance(
                           ISE_RUNTIME.interface_type(Type.GetTypeFromHandle(type_to_create.type)), n));
            }
        }
Exemple #2
0
        public static EIFFEL_TYPE_INFO create_type(
            RT_TYPE a_type,
            EIFFEL_TYPE_INFO a_current
            )
        // Create new instance of `a_type' in context of `a_current' object.
        // Handles creation of class type as well as creation of formal generic parameter.
        {
            RT_CLASS_TYPE   type_to_create;
            RT_GENERIC_TYPE computed_type;

            // Evaluate type in context of Current object.
            type_to_create = (RT_CLASS_TYPE)a_type.evaluated_type(a_current.____type());

            // Create new object of type `type_to_create'.
            computed_type = type_to_create as RT_GENERIC_TYPE;
            return((EIFFEL_TYPE_INFO)create_instance(Type.GetTypeFromHandle(type_to_create.type), computed_type));
        }