Author: raja
Date: 2006-03-20 04:30:47 -0500 (Mon, 20 Mar 2006)
New Revision: 58176

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/icall.c
Log:
* icall.c (ves_icall_Type_GetInterfaces): Avoid using
'interface_id' field of open generic types.


Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2006-03-20 09:29:44 UTC (rev 58175)
+++ trunk/mono/mono/metadata/ChangeLog  2006-03-20 09:30:47 UTC (rev 58176)
@@ -1,4 +1,8 @@
+2006-03-20  Raja R Harinath  <[EMAIL PROTECTED]>
 
+       * icall.c (ves_icall_Type_GetInterfaces): Avoid using
+       'interface_id' field of open generic types.
+
 Fri Mar 17 18:06:06 CET 2006 Paolo Molaro <[EMAIL PROTECTED]>
 
        * object.h, object.c, icall.c: added functions to deal with

Modified: trunk/mono/mono/metadata/icall.c
===================================================================
--- trunk/mono/mono/metadata/icall.c    2006-03-20 09:29:44 UTC (rev 58175)
+++ trunk/mono/mono/metadata/icall.c    2006-03-20 09:30:47 UTC (rev 58176)
@@ -1662,6 +1662,7 @@
        MonoClass *class = mono_class_from_mono_type (type->type);
        MonoClass *parent;
        MonoBitSet *slots;
+       MonoGenericContext *context = NULL;
 
        MONO_ARCH_SAVE_REGS;
 
@@ -1675,6 +1676,12 @@
                return mono_array_new (domain, mono_defaults.monotype_class, 0);
        }
 
+       /* open generic-instance classes can share their interface_id */
+       if (class->generic_class && class->generic_class->inst->is_open) {
+               context = class->generic_class->context;
+               class = class->generic_class->container_class;
+       }
+
        for (parent = class; parent; parent = parent->parent) {
                GPtrArray *tmp_ifaces = mono_class_get_implemented_interfaces 
(parent);
                if (tmp_ifaces) {
@@ -1700,8 +1707,11 @@
        intf = mono_array_new (domain, mono_defaults.monotype_class, 
ifaces->len);
        for (i = 0; i < ifaces->len; ++i) {
                MonoClass *ic = g_ptr_array_index (ifaces, i);
+               MonoType *ret = &ic->byval_arg;
+               if (context && ic->generic_class && 
ic->generic_class->inst->is_open)
+                       ret = mono_class_inflate_generic_type (ret, context);
                
-               mono_array_setref (intf, i, mono_type_get_object (domain, 
&ic->byval_arg));
+               mono_array_setref (intf, i, mono_type_get_object (domain, ret));
        }
        g_ptr_array_free (ifaces, TRUE);
 

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

Reply via email to