Пример #1
0
/*
 * feature -- Conformance
 */
        public override bool conform_to(RT_TYPE other)
        // Does `Current' conform to `other'?
        {
            RT_TUPLE_TYPE l_tuple_type = other as RT_TUPLE_TYPE;

            RT_TYPE [] l_generics, l_type_generics;
            bool       Result;
            int        i, nb;

            if (l_tuple_type != null)
            {
                // Conformance between TUPLEs.
                nb              = l_tuple_type.count;
                Result          = count >= nb;
                l_generics      = generics;
                l_type_generics = l_tuple_type.generics;
                for (i = 0; (i < nb) && Result; i++)
                {
                    Result = (l_generics [i]).conform_to(l_type_generics [i]);
                }
            }
            else
            {
                // Conformance TUPLE -> other class types.
                Result = base.conform_to(other);
            }
            return(Result);
        }
Пример #2
0
/*
 * feature -- Conformance
 */
        public override bool conform_to(RT_TYPE other)
        // Does `Current' conform to `other'?
        {
            RT_CLASS_TYPE l_other = other as RT_CLASS_TYPE;
            bool          Result  = l_other != null;

            if (Result)
            {
                Result = l_other.dotnet_type().IsAssignableFrom(dotnet_type()) &&
                         l_other.valid_generic(this);
            }
            return(Result);
        }
Пример #3
0
        // 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.
        public static object create_array(
		int n,
		RT_TYPE a_type,
		EIFFEL_TYPE_INFO a_current,
		RuntimeTypeHandle any_type_handle
	)
        {
            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);
            }
        }
Пример #4
0
        // Does `Current' conform to `other'?
        /*
        feature -- Conformance
        */
        public override bool conform_to(RT_TYPE other)
        {
            RT_TUPLE_TYPE l_tuple_type = other as RT_TUPLE_TYPE;
            RT_TYPE [] l_generics, l_type_generics;
            bool Result;
            int i, nb;

            if (l_tuple_type != null) {
                // Conformance between TUPLEs.
            nb = l_tuple_type.count;
            Result = count >= nb;
            l_generics = generics;
            l_type_generics = l_tuple_type.generics;
            for (i = 0; (i < nb) && Result; i++) {
                Result = (l_generics [i]).conform_to (l_type_generics [i]);
            }
            } else {
                // Conformance TUPLE -> other class types.
            Result = base.conform_to (other);
            }
            return Result;
        }
Пример #5
0
 // Does `Current' conform to `other'?
 /*
 feature -- Conformance
 */
 public virtual bool conform_to(RT_TYPE other)
 {
     return false;
 }
Пример #6
0
/*
 * feature -- Conformance
 */
        public virtual bool conform_to(RT_TYPE other)
        // Does `Current' conform to `other'?
        {
            return(false);
        }
Пример #7
0
        // 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.
        public static EIFFEL_TYPE_INFO create_type(
		RT_TYPE a_type,
		EIFFEL_TYPE_INFO a_current
	)
        {
            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);
        }
Пример #8
0
 // Initialize `Current' with type `a_type'.
 public RT_GENERIC_TYPE(RuntimeTypeHandle a_type, RT_TYPE[] an_array)
 {
     type = a_type;
     set_generics (an_array);
 }
Пример #9
0
 // Assign `an_array' to `generics'.
 /*
 feature -- Settings
 */
 public void set_generics(RT_TYPE[] an_array)
 {
     #if ASSERTIONS
     ASSERTIONS.REQUIRE("an_array_not_void", an_array != null);
     #endif
     generics = an_array;
     count = an_array.Length;
 }
Пример #10
0
 // Does `Current' conform to `other'?
 /*
 feature -- Conformance
 */
 public override bool conform_to(RT_TYPE other)
 {
     RT_CLASS_TYPE l_other = other as RT_CLASS_TYPE;
     bool Result = l_other != null;
     if (Result) {
     Result = l_other.dotnet_type().IsAssignableFrom (dotnet_type ()) &&
         l_other.valid_generic (this);
     }
     return Result;
 }
Пример #11
0
 // Initialize `Current' with type `a_type'.
 public RT_TUPLE_TYPE(RuntimeTypeHandle a_type, RT_TYPE[] an_array)
     : base(a_type, an_array)
 {
 }