2002-08-21 Dietmar Maurer <dietmar@ximian.com>
[mono.git] / mcs / class / corlib / System / MonoType.cs
index 10a2bf7424678454e6d93db20741df232a923e94..5b6199b1401143e3a054b06f105fceb1e95c72dc 100644 (file)
@@ -19,6 +19,7 @@ namespace System
                public string name_space;
                public Type parent;
                public Type etype;
+               public Type nested_in;
                public Assembly assembly;
                public TypeAttributes attrs;
                public int rank;
@@ -77,14 +78,10 @@ namespace System
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern override EventInfo[] GetEvents (BindingFlags bindingAttr);
 
-               public override FieldInfo GetField (string name, BindingFlags bindingAttr)
-               {
-                       // FIXME
-                       throw new NotImplementedException ();
-               }
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public extern override FieldInfo GetField (string name, BindingFlags bindingAttr);
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               [MonoTODO]
                public extern override FieldInfo[] GetFields (BindingFlags bindingAttr);
 
                public override Type GetInterface (string name, bool ignoreCase)
@@ -114,13 +111,17 @@ namespace System
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern override MethodInfo[] GetMethods (BindingFlags bindingAttr);
 
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               private static extern MethodInfo get_method (Type type, string name, Type[] types);
+
+
+               [MonoTODO]
                protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr,
                                                             Binder binder,
                                                             CallingConventions callConvention,
                                                             Type[] types, ParameterModifier[] modifiers)
                {
-                       // FIXME
-                       throw new NotImplementedException ();
+                       return get_method (this, name, types);
                }
                
                public override Type GetNestedType( string name, BindingFlags bindingAttr)
@@ -157,10 +158,22 @@ namespace System
                                                        continue;
 
                                        if (types.Length > 0) {
-                                               if (info.GetIndexParameters().Length != types.Length)
+                                               ParameterInfo[] parameterInfo = info.GetIndexParameters ();
+
+                                               if (parameterInfo.Length != types.Length)
+                                                       continue;
+
+                                               int i;
+                                               bool match = true;
+
+                                               for (i = 0; i < types.Length; i ++)
+                                                       if (parameterInfo [i].ParameterType != types [i]) {
+                                                               match = false;
+                                                               break;
+                                                       }
+
+                                               if (!match)
                                                        continue;
-       
-                                               // fixme: compare parameters
                                        }
 
                                        if (null != ret)
@@ -179,7 +192,7 @@ namespace System
 
                protected override bool IsArrayImpl ()
                {
-                       return type_is_subtype_of (this, typeof (System.Array), false);
+                       return type_is_subtype_of (this, typeof (System.Array), false) && this != typeof (System.Array);
                }
 
                protected override bool IsByRefImpl ()
@@ -248,7 +261,7 @@ namespace System
 
                public override string AssemblyQualifiedName {
                        get {
-                               return getFullName () + "," + Assembly.ToString ();
+                               return getFullName () + ", " + Assembly.ToString ();
                        }
                }
 
@@ -318,9 +331,19 @@ namespace System
                        }
                }
 
+               public override Type DeclaringType {
+                       get {
+                               MonoTypeInfo info;
+                               get_type_info (_impl, out info);
+                               return info.nested_in;
+                       }
+               }
+
                public override Type ReflectedType {
                        get {
-                               return null;
+                               MonoTypeInfo info;
+                               get_type_info (_impl, out info);
+                               return info.nested_in;
                        }
                }