}
static void
-encode_constraints (MonoReflectionGenericParam *gparam, guint32 owner, MonoDynamicImage *assembly)
+encode_constraints (MonoReflectionGenericParam *gparam, guint32 owner, MonoDynamicImage *assembly, MonoError *error)
{
MONO_REQ_GC_UNSAFE_MODE;
- MonoError error;
+ mono_error_init (error);
+
MonoDynamicTable *table;
guint32 num_constraints, i;
guint32 *values;
table_idx = table->next_idx ++;
values = table->values + table_idx * MONO_GENPARCONSTRAINT_SIZE;
- MonoType *gpbasetype = mono_reflection_type_get_handle (gparam->base_type, &error);
- mono_error_raise_exception (&error); /* FIXME don't raise here */
+ MonoType *gpbasetype = mono_reflection_type_get_handle (gparam->base_type, error);
+ return_if_nok (error);
values [MONO_GENPARCONSTRAINT_GENERICPAR] = owner;
values [MONO_GENPARCONSTRAINT_CONSTRAINT] = mono_image_typedef_or_ref (assembly, gpbasetype);
}
table_idx = table->next_idx ++;
values = table->values + table_idx * MONO_GENPARCONSTRAINT_SIZE;
- MonoType *constraint_type = mono_reflection_type_get_handle (constraint, &error);
- mono_error_raise_exception (&error); /* FIXME don't raise here */
+ MonoType *constraint_type = mono_reflection_type_get_handle (constraint, error);
+ return_if_nok (error);
values [MONO_GENPARCONSTRAINT_GENERICPAR] = owner;
values [MONO_GENPARCONSTRAINT_CONSTRAINT] = mono_image_typedef_or_ref (assembly, constraint_type);
if (!mono_image_add_cattrs (assembly, table_idx, MONO_CUSTOM_ATTR_GENERICPAR, entry->gparam->cattrs, error))
return FALSE;
- encode_constraints (entry->gparam, table_idx, assembly);
+ encode_constraints (entry->gparam, table_idx, assembly, error);
+ return_val_if_nok (error, FALSE);
return TRUE;
}