Merge pull request #963 from kebby/master
[mono.git] / mcs / class / corlib / System.Reflection / MonoGenericClass.cs
index 3696ef602bf7e654f6f5c92134e6a7b5153c6734..c053a4bbfc3e5195a4c22577524ba73d810dd099 100644 (file)
@@ -31,6 +31,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using System.Reflection;
 using System.Reflection.Emit;
 using System.Collections;
@@ -49,7 +50,12 @@ namespace System.Reflection
         * depends on them.
         */
        [StructLayout (LayoutKind.Sequential)]
-       internal class MonoGenericClass : Type
+       sealed class MonoGenericClass :
+#if NET_4_5
+               TypeInfo
+#else
+               Type
+#endif 
        {
                #region Keep in sync with object-internals.h
 #pragma warning disable 649
@@ -99,56 +105,6 @@ namespace System.Reflection
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                internal static extern void register_with_runtime (Type type);
 
-               EventInfo[] GetEventsFromGTD (BindingFlags flags) {
-                       TypeBuilder tb = generic_type as TypeBuilder;
-                       if (tb == null)
-                               return generic_type.GetEvents (flags);
-
-                       return tb.GetEvents_internal (flags);
-               }
-
-               ConstructorInfo[] GetConstructorsFromGTD (BindingFlags flags)
-               {
-                       TypeBuilder tb = generic_type as TypeBuilder;
-                       if (tb == null)
-                               return generic_type.GetConstructors (flags);
-
-                       return tb.GetConstructorsInternal (flags);
-               }
-
-               /*@hint might not be honored so it required aditional filtering
-               TODO move filtering into here for the TypeBuilder case and remove the hint ugliness 
-               */
-               MethodInfo[] GetMethodsFromGTDWithHint (BindingFlags hint)
-               {
-                       TypeBuilder tb = generic_type as TypeBuilder;
-                       if (tb == null)
-                               return generic_type.GetMethods (hint);
-
-                       if (tb.num_methods == 0)
-                               return new MethodInfo [0];
-                       MethodInfo[] res = new MethodInfo [tb.num_methods];
-                       Array.Copy (tb.methods, 0, res, 0, tb.num_methods);
-                       return res;
-               }
-
-               /*@hint might not be honored so it required aditional filtering
-               TODO move filtering into here for the TypeBuilder case and remove the hint ugliness 
-               */
-               ConstructorInfo[] GetConstructorsFromGTDWithHint (BindingFlags hint)
-               {
-                       TypeBuilder tb = generic_type as TypeBuilder;
-                       if (tb == null)
-                               return generic_type.GetConstructors (hint);
-
-                       if (tb.ctors == null)
-                               return new ConstructorInfo [0];
-                       ConstructorInfo[] res = new ConstructorInfo [tb.ctors.Length];
-                       tb.ctors.CopyTo (res, 0);
-                       return res;
-               }
-
-
                internal bool IsCreated {
                        get {
                                TypeBuilder tb = generic_type as TypeBuilder;
@@ -276,50 +232,6 @@ namespace System.Reflection
                        throw new NotSupportedException ();
                }
 
-               ConstructorInfo[] GetConstructorsInternal (BindingFlags bf, MonoGenericClass reftype)
-               {
-                       ConstructorInfo[] ctors = GetConstructorsFromGTDWithHint (bf);
-                       if (ctors == null || ctors.Length == 0)
-                               return new ConstructorInfo [0];
-
-                       ArrayList l = new ArrayList ();
-                       bool match;
-                       MethodAttributes mattrs;
-
-                       initialize ();
-
-                       for (int i = 0; i < ctors.Length; i++) {
-                               ConstructorInfo c = ctors [i];
-
-                               match = false;
-                               mattrs = c.Attributes;
-                               if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
-                                       if ((bf & BindingFlags.Public) != 0)
-                                               match = true;
-                               } else {
-                                       if ((bf & BindingFlags.NonPublic) != 0)
-                                               match = true;
-                               }
-                               if (!match)
-                                       continue;
-                               match = false;
-                               if ((mattrs & MethodAttributes.Static) != 0) {
-                                       if ((bf & BindingFlags.Static) != 0)
-                                               match = true;
-                               } else {
-                                       if ((bf & BindingFlags.Instance) != 0)
-                                               match = true;
-                               }
-                               if (!match)
-                                       continue;
-                               l.Add (TypeBuilder.GetConstructor (this, c));
-                       }
-
-                       ConstructorInfo[] result = new ConstructorInfo [l.Count];
-                       l.CopyTo (result);
-                       return result;
-               }
-
                public override FieldInfo[] GetFields (BindingFlags bf)
                {
                        throw new NotSupportedException ();
@@ -604,3 +516,4 @@ namespace System.Reflection
        }
 }
 
+#endif