Switch to compiler-tester
[mono.git] / mcs / class / corlib / System / Type.cs
index b8c56ada2893cd385914d482035ad7d52e6f4b33..286b6b4b7929c23ba8d4de72ba0cdac2e12c0359 100644 (file)
@@ -42,7 +42,11 @@ namespace System {
 
        [Serializable]
        [ClassInterface (ClassInterfaceType.None)]
-       public abstract class Type : MemberInfo, IReflect {
+#if NET_2_0
+       [ComVisible (true)]
+       [ComDefaultInterface (typeof (_Type))]
+#endif
+       public abstract class Type : MemberInfo, IReflect, _Type, _MemberInfo {
                
                internal RuntimeTypeHandle _impl;
 
@@ -53,7 +57,7 @@ namespace System {
                public static readonly MemberFilter FilterNameIgnoreCase = new MemberFilter (FilterNameIgnoreCase_impl);
                public static readonly object Missing;
 
-               protected const BindingFlags DefaultBindingFlags =
+               internal const BindingFlags DefaultBindingFlags =
                BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance;
 
                /* implementation of the delegates for MemberFilter */
@@ -380,6 +384,9 @@ namespace System {
 
                public abstract RuntimeTypeHandle TypeHandle {get;}
 
+#if NET_2_0
+               [ComVisible (true)]
+#endif
                public ConstructorInfo TypeInitializer {
                        get {
                                return GetConstructorImpl (
@@ -458,7 +465,7 @@ namespace System {
                }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               public extern static TypeCode GetTypeCodeInternal (Type type);
+               internal extern static TypeCode GetTypeCodeInternal (Type type);
 
                public static TypeCode GetTypeCode (Type type) {
                        type = type.UnderlyingSystemType;
@@ -544,6 +551,9 @@ namespace System {
                                return type_is_subtype_of (a, b, check_interfaces);
                }
 
+#if NET_2_0
+               [ComVisible (true)]
+#endif
                public virtual bool IsSubclassOf (Type c)
                {
                        if (c == null)
@@ -574,7 +584,10 @@ namespace System {
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                internal static extern void GetInterfaceMapData (Type t, Type iface, out MethodInfo[] targets, out MethodInfo[] methods);
-               
+
+#if NET_2_0
+               [ComVisible (true)]
+#endif         
                public virtual InterfaceMapping GetInterfaceMap (Type interfaceType) {
                        InterfaceMapping res;
                        if (interfaceType == null)
@@ -747,6 +760,22 @@ namespace System {
                        return GetMethodImpl (name, bindingAttr, binder, callConvention, types, modifiers);
                }
 
+               internal virtual MethodInfo GetMethod (MethodInfo fromNoninstanciated)
+                {
+                       throw new System.InvalidOperationException ("can only be called in generic type");
+                }
+
+               internal virtual ConstructorInfo GetConstructor (ConstructorInfo fromNoninstanciated)
+                {
+                       throw new System.InvalidOperationException ("can only be called in generic type");
+                }
+
+               internal virtual FieldInfo GetField (FieldInfo fromNoninstanciated)
+                {
+                       throw new System.InvalidOperationException ("can only be called in generic type");
+                }
+
+               
                public MethodInfo[] GetMethods ()
                {
                        return GetMethods (DefaultBindingFlags);
@@ -821,11 +850,7 @@ namespace System {
                                throw new ArgumentNullException ("name");
                        if (types == null)
                                throw new ArgumentNullException ("types");
-                       
-                       foreach (Type t in types)
-                               if (t == null)
-                                       throw new ArgumentNullException ("types");
-                       
+
                        return GetPropertyImpl (name, bindingAttr, binder, returnType, types, modifiers);
                }
 
@@ -873,36 +898,49 @@ namespace System {
                        return typeof (MarshalByRefObject).IsAssignableFrom (this);
                }
 
+#if NET_2_0
+               [ComVisible (true)]
+#endif
                public ConstructorInfo GetConstructor (Type[] types)
                {
-                       return GetConstructor (DefaultBindingFlags, null, CallingConventions.Any, types, null);
+                       return GetConstructorImpl (
+                               DefaultBindingFlags, null, CallingConventions.Any, types, null);
                }
 
+#if NET_2_0
+               [ComVisible (true)]
+#endif
                public ConstructorInfo GetConstructor (BindingFlags bindingAttr, Binder binder,
                                                       Type[] types, ParameterModifier[] modifiers)
                {
-                       return GetConstructor (bindingAttr, binder, CallingConventions.Any, types, modifiers);
+                       return GetConstructorImpl (
+                               bindingAttr, binder, CallingConventions.Any, types, modifiers);
                }
 
+#if NET_2_0
+               [ComVisible (true)]
+#endif
                public ConstructorInfo GetConstructor (BindingFlags bindingAttr, Binder binder,
                                                       CallingConventions callConvention,
                                                       Type[] types, ParameterModifier[] modifiers)
                {
                        if (types == null)
                                throw new ArgumentNullException ("types");
-                       
-                       foreach (Type t in types)
-                               if (t == null)
-                                       throw new ArgumentNullException ("types");
 
                        return GetConstructorImpl (bindingAttr, binder, callConvention, types, modifiers);
                }
 
+#if NET_2_0
+               [ComVisible (true)]
+#endif
                public ConstructorInfo[] GetConstructors ()
                {
                        return GetConstructors (BindingFlags.Public | BindingFlags.Instance);
                }
-               
+
+#if NET_2_0
+               [ComVisible (true)]
+#endif         
                public abstract ConstructorInfo[] GetConstructors (BindingFlags bindingAttr);
 
                public virtual MemberInfo[] GetDefaultMembers ()
@@ -1070,7 +1108,10 @@ namespace System {
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                static extern Type BindGenericParameters (Type gt, Type [] types);
-               
+
+#if NET_2_0
+               [ComVisible (true)]
+#endif         
                public Type BindGenericParameters (Type [] types)
                {
                        if (types == null)
@@ -1085,6 +1126,11 @@ namespace System {
                        return res;
                }
 
+                public Type MakeGenericType (Type[] types)
+                {
+                       return BindGenericParameters (types);
+                }
+
                public abstract bool IsGenericParameter {
                        get;
                }
@@ -1191,6 +1237,24 @@ namespace System {
                                return attr;
                        }
                }
+
+               internal object[] GetPseudoCustomAttributes () {
+                       int count = 0;
+
+                       if (IsSerializable)
+                               count ++;
+
+                       if (count == 0)
+                               return null;
+                       object[] attrs = new object [count];
+                       count = 0;
+
+                       if (IsSerializable)
+                               attrs [count ++] = new SerializableAttribute ();
+
+                       return attrs;
+               }                       
+
 #endif
        }
 }