Author: raja
Date: 2007-06-22 08:36:53 -0400 (Fri, 22 Jun 2007)
New Revision: 80548

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/class.c
   trunk/mono/mono/metadata/icall.c
   trunk/mono/mono/metadata/reflection.c
Log:
Fix MethodInfo.IsGenericMethodDefinition
* reflection.c (mono_reflection_bind_generic_method_parameters):
Rearrange code to ensure we always uses a generic method definition.
* class.c (mono_class_inflate_generic_method_full): Set
'generic_container' field only for generic method definitions.
* icall.c (ves_icall_MonoMethod_get_IsGenericMethodDefinition):
Use presense of 'generic_container' field as indication of being a
generic method definition.


Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2007-06-22 12:35:57 UTC (rev 80547)
+++ trunk/mono/mono/metadata/ChangeLog  2007-06-22 12:36:53 UTC (rev 80548)
@@ -1,3 +1,14 @@
+2007-06-22  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       Fix MethodInfo.IsGenericMethodDefinition
+       * reflection.c (mono_reflection_bind_generic_method_parameters):
+       Rearrange code to ensure we always uses a generic method definition.
+       * class.c (mono_class_inflate_generic_method_full): Set
+       'generic_container' field only for generic method definitions.
+       * icall.c (ves_icall_MonoMethod_get_IsGenericMethodDefinition):
+       Use presense of 'generic_container' field as indication of being a
+       generic method definition.
+
 2007-06-21  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * appdomain.c (MONO_CORLIB_VERSION): Bump corlib version.

Modified: trunk/mono/mono/metadata/class.c
===================================================================
--- trunk/mono/mono/metadata/class.c    2007-06-22 12:35:57 UTC (rev 80547)
+++ trunk/mono/mono/metadata/class.c    2007-06-22 12:36:53 UTC (rev 80548)
@@ -667,7 +667,9 @@
                result->klass = inflated ? mono_class_from_mono_type (inflated) 
: method->klass;
        }
 
-       if (method->generic_container && !context->method_inst)
+       if (context->method_inst)
+               result->generic_container = NULL;
+       else if (method->generic_container)
                iresult->context.method_inst = 
method->generic_container->context.method_inst;
 
        return result;

Modified: trunk/mono/mono/metadata/icall.c
===================================================================
--- trunk/mono/mono/metadata/icall.c    2007-06-22 12:35:57 UTC (rev 80547)
+++ trunk/mono/mono/metadata/icall.c    2007-06-22 12:36:53 UTC (rev 80548)
@@ -2624,7 +2624,7 @@
 {
        MONO_ARCH_SAVE_REGS;
 
-       return !method->method->is_inflated &&
+       return method->method->generic_container &&
                (mono_method_signature (method->method)->generic_param_count != 
0);
 }
 

Modified: trunk/mono/mono/metadata/reflection.c
===================================================================
--- trunk/mono/mono/metadata/reflection.c       2007-06-22 12:35:57 UTC (rev 
80547)
+++ trunk/mono/mono/metadata/reflection.c       2007-06-22 12:36:53 UTC (rev 
80548)
@@ -8821,6 +8821,7 @@
 MonoReflectionMethod*
 mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, 
MonoArray *types)
 {
+       MonoClass *klass;
        MonoMethod *method, *inflated;
        MonoMethodInflated *imethod;
        MonoReflectionMethodBuilder *mb = NULL;
@@ -8843,8 +8844,11 @@
                method = rmethod->method;
        }
 
-       method = mono_get_inflated_method (method);
+       klass = method->klass;
 
+       if (method->is_inflated)
+               method = ((MonoMethodInflated *) method)->declaring;
+
        count = mono_method_signature (method)->generic_param_count;
        if (count != mono_array_length (types))
                return NULL;
@@ -8872,16 +8876,13 @@
        }
        ginst = mono_metadata_lookup_generic_inst (ginst);
 
-       tmp_context.class_inst = method->klass->generic_class ? 
method->klass->generic_class->context.class_inst : NULL;
+       tmp_context.class_inst = klass->generic_class ? 
klass->generic_class->context.class_inst : NULL;
        tmp_context.method_inst = ginst;
 
        inflated = g_hash_table_lookup (container->method_hash, &tmp_context);
        if (inflated)
                return mono_method_get_object (mono_object_domain (rmethod), 
inflated, NULL);
 
-       if (method->is_inflated)
-               method = ((MonoMethodInflated *) method)->declaring;
-
        inflated = mono_class_inflate_generic_method (method, &tmp_context);
        imethod = (MonoMethodInflated *) inflated;
 

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

Reply via email to