public override String class_name() // Name of object's generating type who has Current as an EIFFEL_DERIVATION // (type of which it is a direct instance) { #if ASSERTIONS ASSERTIONS.CHECK("Basic type inserted", Basic_type_names.Contains(type)); #endif return((String)Basic_type_names [type]); }
public override String class_name() // Name of object's generating type who has Current as an EIFFEL_DERIVATION // (type of which it is a direct instance) { String Result; Object [] l_ca; Type l_type; EIFFEL_NAME_ATTRIBUTE l_class_name; l_type = Type.GetTypeFromHandle(type); l_ca = l_type.GetCustomAttributes(typeof(EIFFEL_NAME_ATTRIBUTE), false); #if ASSERTIONS ASSERTIONS.CHECK("`l_ca' should not be Void", l_ca != null); #endif if (l_ca.Length == 1) { l_class_name = (EIFFEL_NAME_ATTRIBUTE)l_ca [0]; Result = l_class_name.name; } else { if (l_type.IsArray) { // This is not the perfect solution as it could be an instance // of System.Array and not a vector array. But that will do for now. Result = "NATIVE_ARRAY"; } else { if (typeof(EIFFEL_TYPE_INFO).IsAssignableFrom(l_type)) { // For an Eiffel generated type Result = l_type.Name; } else { // A .NET type, so we get the full name Result = l_type.FullName; } } } return(Result); }
/* * feature -- Conformance */ public override bool valid_generic(RT_CLASS_TYPE a_type) // Do the generic parameters of `type' conform to those of Current? // Assumes that `a_type' base class conforms to current's base class. { bool Result = false; RT_GENERIC_TYPE l_type; RT_TYPE [] l_generics, l_type_generics; int i, nb; #if ASSERTIONS ASSERTIONS.REQUIRE("a_type_not_null", a_type != null); #endif if (type.Value == a_type.type.Value) { // Types are the same, check that their generic paramters are conformant Result = true; l_type = a_type as RT_GENERIC_TYPE; #if ASSERTIONS ASSERTIONS.CHECK("l_type_not_void", l_type != null); ASSERTIONS.CHECK("same_count", count == l_type.count); #endif l_generics = generics; l_type_generics = l_type.generics; nb = count; for (i = 0; (i < nb) && Result; i++) { Result = (l_type_generics [i]).conform_to(l_generics [i]); } } else { // `type' is a descendant type of Current: so we // have to check the current generic parameters // FIXME: We cannot do that because we do not have a parent table. // for now we simply return True as we know that we have // conformance of classes. Result = true; } return(Result); }
/* * feature -- Status Report */ public override RT_TYPE evaluated_type(RT_GENERIC_TYPE context_type) // Evaluate Current in context of `context_type'. { RT_GENERIC_TYPE Result; RT_TYPE [] l_generics, l_other_generics; int i, nb; if (has_formal()) { i = 0; nb = count; // Duplicate current data as after the evaluation in context // of `context_type' it will be the same except for `generics' // which will only contained fully evaluated types that's why // `generics' is created of type `RT_CLASS_TYPE []'. Result = (RT_GENERIC_TYPE)MemberwiseClone(); l_other_generics = new RT_CLASS_TYPE [nb]; Result.set_generics(l_other_generics); // Evaluate all types contained in `generics' in context of `context_type' l_generics = generics; for (; i < nb; i++) { #if ASSERTIONS ASSERTIONS.CHECK("Valid element type", l_generics [i].evaluated_type(context_type) is RT_CLASS_TYPE); #endif l_other_generics [i] = l_generics [i].evaluated_type(context_type); } Result.set_has_formal(false); } else { Result = this; } return(Result); }