Author: raja
Date: 2007-01-12 04:41:11 -0500 (Fri, 12 Jan 2007)
New Revision: 70905

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/reflection.c
Log:
* reflection.c (inflate_mono_method): Reuse method instantiation
from the generic method, if available.


Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2007-01-12 09:30:53 UTC (rev 70904)
+++ trunk/mono/mono/metadata/ChangeLog  2007-01-12 09:41:11 UTC (rev 70905)
@@ -1,3 +1,8 @@
+2007-01-12  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * reflection.c (inflate_mono_method): Reuse method instantiation
+       from the generic method, if available.
+
 2007-01-11  Jonathan Chambers  <[EMAIL PROTECTED]>
 
        * marshal.c (emit_marshal_variant): Fix conv_arg

Modified: trunk/mono/mono/metadata/reflection.c
===================================================================
--- trunk/mono/mono/metadata/reflection.c       2007-01-12 09:30:53 UTC (rev 
70904)
+++ trunk/mono/mono/metadata/reflection.c       2007-01-12 09:41:11 UTC (rev 
70905)
@@ -8960,38 +8960,27 @@
        MonoGenericMethod *gmethod = NULL;
        MonoGenericContext *context;
        MonoClass *klass;
-       int i, n;
 
        klass = mono_class_from_mono_type (type->type.type);
        g_assert (klass->generic_class);
        context = mono_class_get_context (klass);
 
-       n = mono_method_signature (method)->generic_param_count;
-       if (n) {
+       if (method->generic_container) {
+               g_assert (method->klass == 
klass->generic_class->container_class);
+
                gmethod = g_new0 (MonoGenericMethod, 1);
                gmethod->class_inst = klass->generic_class->inst;
                gmethod->container = method->generic_container;
                MOVING_GC_REGISTER (&gmethod->reflection_info);
                gmethod->reflection_info = obj;
+               gmethod->inst = 
method->generic_container->context.gmethod->inst;
 
-               gmethod->inst = g_new0 (MonoGenericInst, 1);
-               gmethod->inst->type_argc = n;
-               gmethod->inst->type_argv = g_new0 (MonoType *, n);
-
-               for (i = 0; i < n; i++) {
-                       MonoGenericParam *gparam = 
&method->generic_container->type_params [i];
-                       g_assert (gparam->pklass);
-                       gmethod->inst->type_argv [i] = 
&gparam->pklass->byval_arg;
-               }
-
-               g_assert (gmethod->container->parent == 
klass->generic_class->container_class->generic_container);
-
                context = g_new0 (MonoGenericContext, 1);
                context->class_inst = klass->generic_class->inst;
                context->gmethod = gmethod;
        }
 
-       return mono_class_inflate_generic_method (method, context);
+       return mono_class_inflate_generic_method_full (method, klass, context);
 }
 
 static MonoMethod *

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to