mono_raise_exception (mono_get_exception_invalid_operation (NULL));
if (image_is_dynamic (field->parent->image)) {
- /* FIXME: */
- g_assert_not_reached ();
+ MonoClass *klass = field->parent;
+ int fidx = field - klass->fields;
+
+ g_assert (fidx >= 0 && fidx < klass->field.count);
+ g_assert (klass->ext);
+ g_assert (klass->ext->field_def_values);
+ def_type = klass->ext->field_def_values [fidx].def_type;
+ def_value = klass->ext->field_def_values [fidx].data;
+ if (def_type == MONO_TYPE_END)
+ mono_raise_exception (mono_get_exception_invalid_operation (NULL));
+ } else {
+ def_value = mono_class_get_field_default_value (field, &def_type);
+ /* FIXME, maybe we should try to raise TLE if field->parent is broken */
+ if (!def_value)
+ mono_raise_exception (mono_get_exception_invalid_operation (NULL));
}
- def_value = mono_class_get_field_default_value (field, &def_type);
- if (!def_value) /*FIXME, maybe we should try to raise TLE if field->parent is broken */
- mono_raise_exception (mono_get_exception_invalid_operation (NULL));
-
/*FIXME unify this with reflection.c:mono_get_object_from_blob*/
switch (def_type) {
case MONO_TYPE_U1:
read_enum_value (char *mem, int type)
{
switch (type) {
+ case MONO_TYPE_BOOLEAN:
case MONO_TYPE_U1:
return *(guint8*)mem;
case MONO_TYPE_I1:
return *(gint8*)mem;
+ case MONO_TYPE_CHAR:
case MONO_TYPE_U2:
return *(guint16*)mem;
case MONO_TYPE_I2:
if (!enumc->enumtype)
mono_raise_exception (mono_get_exception_argument ("enumType", "Type provided must be an Enum."));
- if (!((objc->enumtype) || (objc->byval_arg.type >= MONO_TYPE_I1 && objc->byval_arg.type <= MONO_TYPE_U8)))
+ if (!((objc->enumtype) || (objc->byval_arg.type >= MONO_TYPE_BOOLEAN && objc->byval_arg.type <= MONO_TYPE_U8)))
mono_raise_exception (mono_get_exception_argument ("value", "The value passed in must be an enum base or an underlying type for an enum, such as an Int32."));
etype = mono_class_enum_basetype (enumc);