2004-10-14 Zoltan Varga <vargaz@freemail.hu>
authorZoltan Varga <vargaz@gmail.com>
Thu, 14 Oct 2004 19:14:30 +0000 (19:14 -0000)
committerZoltan Varga <vargaz@gmail.com>
Thu, 14 Oct 2004 19:14:30 +0000 (19:14 -0000)
* reflection.c (mono_method_body_get_object): Implement some fields.

svn path=/trunk/mono/; revision=35005

mono/metadata/ChangeLog
mono/metadata/reflection.c

index 20b9381632f9c4b005809f2dde7ed3d01266603b..a3baa5a087f25a3f955fb7a3123bf1de88fb17e0 100644 (file)
@@ -1,3 +1,7 @@
+2004-10-14  Zoltan Varga  <vargaz@freemail.hu>
+
+       * reflection.c (mono_method_body_get_object): Implement some fields.
+
 2004-10-12  Martin Baulig  <martin@ximian.com>
 
        * reflection.c (mono_reflection_bind_generic_parameters): Small
index 36b3aefc67cc86d8103a856b505968097eeb3247..4716faf339c1ba26903c1418a6067f6f808836d0 100644 (file)
@@ -5480,13 +5480,17 @@ MonoReflectionMethodBody*
 mono_method_body_get_object (MonoDomain *domain, MonoMethod *method)
 {
        static MonoClass *System_Reflection_MethodBody = NULL;
+       static MonoClass *System_Reflection_LocalVariableInfo = NULL;
        MonoClass *klass;
        MonoReflectionMethodBody *ret;
        MonoMethodNormal *mn;
        MonoMethodHeader *header;
+       int i;
 
        if (!System_Reflection_MethodBody)
                System_Reflection_MethodBody = mono_class_from_name (mono_defaults.corlib, "System.Reflection", "MethodBody");
+       if (!System_Reflection_LocalVariableInfo)
+               System_Reflection_LocalVariableInfo = mono_class_from_name (mono_defaults.corlib, "System.Reflection", "LocalVariableInfo");
 
        CHECK_OBJECT (MonoReflectionMethodBody *, method, NULL);
 
@@ -5499,8 +5503,17 @@ mono_method_body_get_object (MonoDomain *domain, MonoMethod *method)
        ret = (MonoReflectionMethodBody*)mono_object_new (domain, System_Reflection_MethodBody);
        /* FIXME: Other fields */
        ret->init_locals = header->init_locals;
+       ret->max_stack = header->max_stack;
        ret->il = mono_array_new (domain, mono_defaults.byte_class, header->code_size);
        memcpy (mono_array_addr (ret->il, guint8*, 0), header->code, header->code_size);
+       ret->locals = mono_array_new (domain, System_Reflection_LocalVariableInfo, header->num_locals);
+       for (i = 0; i < header->num_locals; ++i) {
+               MonoReflectionLocalVariableInfo *info = (MonoReflectionLocalVariableInfo*)mono_object_new (domain, System_Reflection_LocalVariableInfo);
+               info->local_type = mono_type_get_object (domain, header->locals [i]);
+               info->is_pinned = header->locals [i]->pinned;
+               info->local_index = 0;
+       }
+               
        CACHE_OBJECT (method, ret, NULL);
        return ret;
 }