Skip to content

Commit

Permalink
2009-01-21 Mark Probst <mark.probst@gmail.com>
Browse files Browse the repository at this point in the history
	Backport of r123958.

	* reflection.c (resolve_object): For fields, inflate the class and
	then get the field in the inflated class.

svn path=/branches/mono-2-2/mono/; revision=123960
  • Loading branch information
schani committed Jan 20, 2009
1 parent c63dbe4 commit 3cb0fc7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
7 changes: 7 additions & 0 deletions mono/metadata/ChangeLog
@@ -1,3 +1,10 @@
2009-01-21 Mark Probst <mark.probst@gmail.com>

Backport of r123958.

* reflection.c (resolve_object): For fields, inflate the class and
then get the field in the inflated class.

2009-01-20 Mark Probst <mark.probst@gmail.com>

Backport of r123917.
Expand Down
17 changes: 16 additions & 1 deletion mono/metadata/reflection.c
Expand Up @@ -10466,7 +10466,22 @@ resolve_object (MonoImage *image, MonoObject *obj, MonoClass **handle_class, Mon
result = mono_class_inflate_generic_method (result, context);
*handle_class = mono_defaults.methodhandle_class;
} else if (strcmp (obj->vtable->klass->name, "MonoField") == 0) {
result = ((MonoReflectionField*)obj)->field;
MonoClassField *field = ((MonoReflectionField*)obj)->field;
if (context) {
MonoType *inflated = mono_class_inflate_generic_type (&field->parent->byval_arg, context);
MonoClass *class = mono_class_from_mono_type (inflated);
MonoClassField *inflated_field;
gpointer iter = NULL;
mono_metadata_free_type (inflated);
while ((inflated_field = mono_class_get_fields (class, &iter))) {
if (!strcmp (field->name, inflated_field->name))
break;
}
g_assert (inflated_field && !strcmp (field->name, inflated_field->name));
result = inflated_field;
} else {
result = field;
}
*handle_class = mono_defaults.fieldhandle_class;
g_assert (result);
} else if (strcmp (obj->vtable->klass->name, "FieldBuilder") == 0) {
Expand Down

0 comments on commit 3cb0fc7

Please sign in to comment.