diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog index f82c7fd5cd781..b1d434214856b 100644 --- a/mono/metadata/ChangeLog +++ b/mono/metadata/ChangeLog @@ -1,3 +1,9 @@ +2003-09-07 Martin Baulig + + * class.c (mono_class_init): If we're a generic instance, inflate + all our methods instead of loading them from the image. + (mono_class_from_generic): Set `class->methods = gklass->methods'. + 2003-09-07 Martin Baulig * mono-debug-debugger.c: Added support for constructors. diff --git a/mono/metadata/class.c b/mono/metadata/class.c index 2db15f3b056eb..3dfa9d05c8ed3 100644 --- a/mono/metadata/class.c +++ b/mono/metadata/class.c @@ -1142,17 +1142,18 @@ mono_class_init (MonoClass *class) class->methods [1] = ctor; } } else { - class->methods = g_new (MonoMethod*, class->method.count); - for (i = 0; i < class->method.count; ++i) { - class->methods [i] = mono_get_method (class->image, - MONO_TOKEN_METHOD_DEF | (i + class->method.first + 1), class); - } if (class->generic_inst) { for (i = 0; i < class->method.count; ++i) { class->methods [i] = inflate_generic_method (class->methods [i], class->generic_inst->data.generic_inst, NULL); class->methods [i]->klass = class; /*g_print ("inflated method %s in %s\n", class->methods [i]->name, class->name);*/ } + } else { + class->methods = g_new (MonoMethod*, class->method.count); + for (i = 0; i < class->method.count; ++i) { + class->methods [i] = mono_get_method (class->image, + MONO_TOKEN_METHOD_DEF | (i + class->method.first + 1), class); + } } } @@ -1613,6 +1614,7 @@ mono_class_from_generic (MonoType *gtype) class->field = gklass->field; class->method = gklass->method; + class->methods = gklass->methods; /*g_print ("instantiating class from %s.%s to %s\n", gklass->name_space, gklass->name, class->name); g_print ("methods: %d, fields: %d\n", class->method.count, class->field.count);*/