return mono_class_get_type (klass);
}
+ICALL_EXPORT void
+ves_icall_Mono_RuntimeGPtrArrayHandle_GPtrArrayFree (GPtrArray *ptr_array)
+{
+ g_ptr_array_free (ptr_array, TRUE);
+}
+
+ICALL_EXPORT void
+ves_icall_Mono_SafeStringMarshal_GFree (void *c_str)
+{
+ g_free (c_str);
+}
+
+ICALL_EXPORT char*
+ves_icall_Mono_SafeStringMarshal_StringToUtf8 (MonoString *s)
+{
+ MonoError error;
+ char *res = mono_string_to_utf8_checked (s, &error);
+ mono_error_set_pending_exception (&error);
+ return res;
+}
+
/* System.TypeCode */
typedef enum {
TYPECODE_EMPTY,
MonoError error;
gboolean found = FALSE;
MonoClass *klass;
- MonoClass *k;
g_assert (handle);
} else {
klass = mono_class_from_mono_type (type);
- /* Check that the field belongs to the class */
- for (k = klass; k; k = k->parent) {
- if (k == handle->parent) {
- found = TRUE;
- break;
- }
- }
+ found = klass == handle->parent || mono_class_has_parent (klass, handle->parent);
if (!found)
/* The managed code will throw the exception */
return result;
}
+ICALL_EXPORT MonoReflectionEvent*
+ves_icall_System_Reflection_EventInfo_internal_from_handle_type (MonoEvent *handle, MonoType *type)
+{
+ MonoError error;
+ MonoClass *klass;
+
+ g_assert (handle);
+
+ if (!type) {
+ klass = handle->parent;
+ } else {
+ klass = mono_class_from_mono_type (type);
+
+ gboolean found = klass == handle->parent || mono_class_has_parent (klass, handle->parent);
+ if (!found)
+ /* Managed code will throw an exception */
+ return NULL;
+ }
+
+ MonoReflectionEvent *result = mono_event_get_object_checked (mono_domain_get (), klass, handle, &error);
+ mono_error_set_pending_exception (&error);
+ return result;
+}
+
+
+ICALL_EXPORT MonoReflectionProperty*
+ves_icall_System_Reflection_PropertyInfo_internal_from_handle_type (MonoProperty *handle, MonoType *type)
+{
+ MonoError error;
+ MonoClass *klass;
+
+ g_assert (handle);
+
+ if (!type) {
+ klass = handle->parent;
+ } else {
+ klass = mono_class_from_mono_type (type);
+
+ gboolean found = klass == handle->parent || mono_class_has_parent (klass, handle->parent);
+ if (!found)
+ /* Managed code will throw an exception */
+ return NULL;
+ }
+
+ MonoReflectionProperty *result = mono_property_get_object_checked (mono_domain_get (), klass, handle, &error);
+ mono_error_set_pending_exception (&error);
+ return result;
+}
+
ICALL_EXPORT MonoArray*
ves_icall_System_Reflection_FieldInfo_GetTypeModifiers (MonoReflectionField *field, MonoBoolean optional)
{
BFLAGS_OptionalParamBinding = 0x40000
};
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetFields_internal (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoReflectionType *reftype)
+ICALL_EXPORT GPtrArray*
+ves_icall_RuntimeType_GetFields_native (MonoReflectionType *type, char *utf8_name, guint32 bflags)
{
MonoError error;
- MonoDomain *domain;
- MonoClass *startklass, *klass, *refklass;
- MonoArray *res;
- MonoObject *member;
- int i, match;
+ MonoClass *startklass, *klass;
+ int match;
gpointer iter;
- char *utf8_name = NULL;
int (*compare_func) (const char *s1, const char *s2) = NULL;
MonoClassField *field;
- MonoPtrArray tmp_array;
- domain = ((MonoObject *)type)->vtable->domain;
if (type->type->byref) {
- MonoArray *result = mono_array_new_checked (domain, mono_defaults.field_info_class, 0, &error);
- mono_error_set_pending_exception (&error);
- return result;
+ return g_ptr_array_new ();
}
+ mono_error_init (&error);
+
+ compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
+
klass = startklass = mono_class_from_mono_type (type->type);
- refklass = mono_class_from_mono_type (reftype->type);
- mono_ptr_array_init (tmp_array, 2, MONO_ROOT_SOURCE_REFLECTION, "temporary reflection fields list");
+ GPtrArray *ptr_array = g_ptr_array_sized_new (16);
handle_parent:
if (mono_class_has_failure (klass)) {
- mono_ptr_array_destroy (tmp_array);
- mono_set_pending_exception (mono_class_get_exception_for_failure (klass));
- return NULL;
+ mono_error_set_for_class_failure (&error, klass);
+ goto fail;
}
iter = NULL;
if (!match)
continue;
- if (name != NULL) {
- if (utf8_name == NULL) {
- utf8_name = mono_string_to_utf8_checked (name, &error);
- if (!is_ok (&error))
- goto fail;
- compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
- }
-
- if (compare_func (mono_field_get_name (field), utf8_name))
+ if (utf8_name != NULL && compare_func (mono_field_get_name (field), utf8_name))
continue;
- }
- member = (MonoObject*)mono_field_get_object_checked (domain, refklass, field, &error);
- if (!mono_error_ok (&error))
- goto fail;
- mono_ptr_array_append (tmp_array, member);
+ g_ptr_array_add (ptr_array, field);
}
if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
goto handle_parent;
- res = mono_array_new_cached (domain, mono_defaults.field_info_class, mono_ptr_array_size (tmp_array), &error);
- if (!is_ok (&error))
- goto fail;
-
- for (i = 0; i < mono_ptr_array_size (tmp_array); ++i)
- mono_array_setref (res, i, mono_ptr_array_get (tmp_array, i));
-
- mono_ptr_array_destroy (tmp_array);
+ return ptr_array;
- if (utf8_name != NULL)
- g_free (utf8_name);
-
- return res;
fail:
- mono_ptr_array_destroy (tmp_array);
+ g_ptr_array_free (ptr_array, TRUE);
mono_error_set_pending_exception (&error);
return NULL;
}
}
GPtrArray*
-mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bflags, gboolean ignore_case, gboolean allow_ctors, MonoException **ex)
+mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bflags, gboolean ignore_case, gboolean allow_ctors, MonoError *error)
{
GPtrArray *array;
MonoClass *startklass;
array = g_ptr_array_new ();
startklass = klass;
- *ex = NULL;
+ mono_error_init (error);
if (name != NULL)
compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
g_free (method_slots);
g_ptr_array_free (array, TRUE);
- if (mono_class_has_failure (klass)) {
- *ex = mono_class_get_exception_for_failure (klass);
- } else {
- *ex = mono_get_exception_execution_engine ("Unknown error");
- }
+ g_assert (mono_class_has_failure (klass));
+ mono_error_set_for_class_failure (error, klass);
return NULL;
}
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetMethodsByName (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case, MonoReflectionType *reftype)
+ICALL_EXPORT GPtrArray*
+ves_icall_RuntimeType_GetMethodsByName_native (MonoReflectionType *type, const char *mname, guint32 bflags, MonoBoolean ignore_case)
{
- static MonoClass *MethodInfo_array;
MonoError error;
- MonoDomain *domain;
- MonoArray *res;
- MonoVTable *array_vtable;
- MonoException *ex = NULL;
- const char *mname = NULL;
GPtrArray *method_array;
- MonoClass *klass, *refklass;
- int i;
-
- mono_error_init (&error);
-
- if (!MethodInfo_array) {
- MonoClass *klass = mono_array_class_get (mono_defaults.method_info_class, 1);
- mono_memory_barrier ();
- MethodInfo_array = klass;
- }
+ MonoClass *klass;
klass = mono_class_from_mono_type (type->type);
- refklass = mono_class_from_mono_type (reftype->type);
- domain = ((MonoObject *)type)->vtable->domain;
- array_vtable = mono_class_vtable_full (domain, MethodInfo_array, &error);
- if (!is_ok (&error)) {
- mono_error_set_pending_exception (&error);
- return NULL;
- }
if (type->type->byref) {
- res = mono_array_new_specific_checked (array_vtable, 0, &error);
- mono_error_set_pending_exception (&error);
-
- return res;
- }
-
- if (name) {
- mname = mono_string_to_utf8_checked (name, &error);
- if (mono_error_set_pending_exception (&error))
- return NULL;
- }
-
- method_array = mono_class_get_methods_by_name (klass, mname, bflags, ignore_case, FALSE, &ex);
- g_free ((char*)mname);
- if (ex) {
- mono_set_pending_exception (ex);
- return NULL;
+ return g_ptr_array_new ();
}
- res = mono_array_new_specific_checked (array_vtable, method_array->len, &error);
- if (!mono_error_ok (&error)) {
- mono_error_set_pending_exception (&error);
- return NULL;
- }
-
- for (i = 0; i < method_array->len; ++i) {
- MonoMethod *method = (MonoMethod *)g_ptr_array_index (method_array, i);
- MonoReflectionMethod *rm = mono_method_get_object_checked (domain, method, refklass, &error);
- if (!mono_error_ok (&error))
- goto failure;
- mono_array_setref (res, i, rm);
- }
-
-failure:
- g_ptr_array_free (method_array, TRUE);
- if (!mono_error_ok (&error))
- mono_set_pending_exception (mono_error_convert_to_exception (&error));
- return res;
+ method_array = mono_class_get_methods_by_name (klass, mname, bflags, ignore_case, FALSE, &error);
+ mono_error_set_pending_exception (&error);
+ return method_array;
}
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetConstructors_internal (MonoReflectionType *type, guint32 bflags, MonoReflectionType *reftype)
+ICALL_EXPORT GPtrArray*
+ves_icall_RuntimeType_GetConstructors_native (MonoReflectionType *type, guint32 bflags)
{
- MonoDomain *domain;
- MonoClass *startklass, *klass, *refklass;
- MonoArray *res = NULL;
+ MonoClass *startklass, *klass;
MonoMethod *method;
- MonoObject *member;
- int i, match;
+ int match;
gpointer iter = NULL;
- MonoPtrArray tmp_array;
+ GPtrArray *res_array;
MonoError error;
- domain = ((MonoObject *)type)->vtable->domain;
if (type->type->byref) {
- res = mono_array_new_cached (domain, mono_defaults.method_info_class, 0, &error);
- mono_error_set_pending_exception (&error);
- return res;
+ return g_ptr_array_new ();
}
- mono_ptr_array_init (tmp_array, 4, MONO_ROOT_SOURCE_REFLECTION, "temporary reflection constructors list"); /*FIXME, guestimating*/
-
-
klass = startklass = mono_class_from_mono_type (type->type);
- refklass = mono_class_from_mono_type (reftype->type);
mono_class_setup_methods (klass);
if (mono_class_has_failure (klass)) {
- mono_set_pending_exception (mono_class_get_exception_for_failure (klass));
- goto leave;
+ mono_error_init (&error);
+ mono_error_set_for_class_failure (&error, klass);
+ mono_error_set_pending_exception (&error);
+ return NULL;
}
+ res_array = g_ptr_array_sized_new (4); /* FIXME, guestimating */
+
iter = NULL;
while ((method = mono_class_get_methods (klass, &iter))) {
match = 0;
if (!match)
continue;
- member = (MonoObject*)mono_method_get_object_checked (domain, method, refklass, &error);
- if (mono_error_set_pending_exception (&error))
- goto leave;
-
- mono_ptr_array_append (tmp_array, member);
+ g_ptr_array_add (res_array, method);
}
- res = mono_array_new_cached (domain, mono_class_get_constructor_info_class (), mono_ptr_array_size (tmp_array), &error);
- if (mono_error_set_pending_exception (&error))
- goto leave;
-
- for (i = 0; i < mono_ptr_array_size (tmp_array); ++i)
- mono_array_setref (res, i, mono_ptr_array_get (tmp_array, i));
-
-leave:
- mono_ptr_array_destroy (tmp_array);
-
- return res;
+ return res_array;
}
static guint
return method_nonpublic (accessor, start_klass);
}
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetPropertiesByName (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case, MonoReflectionType *reftype)
+ICALL_EXPORT GPtrArray*
+ves_icall_RuntimeType_GetPropertiesByName_native (MonoReflectionType *type, gchar *propname, guint32 bflags, MonoBoolean ignore_case)
{
MonoError error;
- MonoDomain *domain;
MonoClass *startklass, *klass;
- MonoArray *res;
MonoMethod *method;
MonoProperty *prop;
- int i, match;
+ int match;
guint32 flags;
- gchar *propname = NULL;
int (*compare_func) (const char *s1, const char *s2) = NULL;
gpointer iter;
GHashTable *properties = NULL;
- MonoPtrArray tmp_array;
+ GPtrArray *res_array;
- mono_error_init (&error);
-
- domain = ((MonoObject *)type)->vtable->domain;
if (type->type->byref) {
- res = mono_array_new_cached (domain, mono_class_get_property_info_class (), 0, &error);
- mono_error_set_pending_exception (&error);
- return res;
+ return g_ptr_array_new ();
}
- mono_ptr_array_init (tmp_array, 8, MONO_ROOT_SOURCE_REFLECTION, "temporary reflection properties list"); /*This the average for ASP.NET types*/
-
+ mono_error_init (&error);
+
klass = startklass = mono_class_from_mono_type (type->type);
- if (name != NULL) {
- propname = mono_string_to_utf8_checked (name, &error);
- if (mono_error_set_pending_exception (&error))
- return NULL;
- compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
- }
+ compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
+
+ res_array = g_ptr_array_sized_new (8); /*This the average for ASP.NET types*/
properties = g_hash_table_new (property_hash, (GEqualFunc)property_equal);
handle_parent:
mono_class_setup_methods (klass);
mono_class_setup_vtable (klass);
- if (mono_class_has_failure (klass))
+ if (mono_class_has_failure (klass)) {
+ mono_error_set_for_class_failure (&error, klass);
goto loader_error;
+ }
iter = NULL;
while ((prop = mono_class_get_properties (klass, &iter))) {
continue;
match = 0;
- if (name != NULL) {
- if (compare_func (propname, prop->name))
- continue;
- }
+ if (propname != NULL && compare_func (propname, prop->name))
+ continue;
if (g_hash_table_lookup (properties, prop))
continue;
- MonoReflectionProperty *pr = mono_property_get_object_checked (domain, startklass, prop, &error);
- if (!pr)
- goto failure;
- mono_ptr_array_append (tmp_array, pr);
+ g_ptr_array_add (res_array, prop);
g_hash_table_insert (properties, prop, prop);
}
- if ((!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent)))
+ if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
goto handle_parent;
g_hash_table_destroy (properties);
- g_free (propname);
-
- res = mono_array_new_cached (domain, mono_class_get_property_info_class (), mono_ptr_array_size (tmp_array), &error);
- if (!is_ok (&error))
- goto failure;
- for (i = 0; i < mono_ptr_array_size (tmp_array); ++i)
- mono_array_setref (res, i, mono_ptr_array_get (tmp_array, i));
-
- mono_ptr_array_destroy (tmp_array);
-
- return res;
+ return res_array;
loader_error:
- if (mono_class_has_failure (klass))
- mono_error_set_for_class_failure (&error, klass);
-
-failure:
if (properties)
g_hash_table_destroy (properties);
- if (name)
- g_free (propname);
- mono_ptr_array_destroy (tmp_array);
+ g_ptr_array_free (res_array, TRUE);
mono_error_set_pending_exception (&error);
return g_str_equal (event1->name, event2->name);
}
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetEvents_internal (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoReflectionType *reftype)
+ICALL_EXPORT GPtrArray*
+ves_icall_RuntimeType_GetEvents_native (MonoReflectionType *type, char *utf8_name, guint32 bflags)
{
MonoError error;
- MonoDomain *domain;
MonoClass *startklass, *klass;
- MonoArray *res;
MonoMethod *method;
MonoEvent *event;
- int i, match;
+ int match;
gpointer iter;
- char *utf8_name = NULL;
int (*compare_func) (const char *s1, const char *s2) = NULL;
GHashTable *events = NULL;
- MonoPtrArray tmp_array;
+ GPtrArray *res_array;
- mono_error_init (&error);
-
- domain = mono_object_domain (type);
if (type->type->byref) {
- res = mono_array_new_cached (domain, mono_class_get_event_info_class (), 0, &error);
- mono_error_set_pending_exception (&error);
- return res;
+ return g_ptr_array_new ();
}
- mono_ptr_array_init (tmp_array, 4, MONO_ROOT_SOURCE_REFLECTION, "temporary reflection events list");
+ mono_error_init (&error);
+
+ compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
+
+ res_array = g_ptr_array_sized_new (4);
klass = startklass = mono_class_from_mono_type (type->type);
handle_parent:
mono_class_setup_methods (klass);
mono_class_setup_vtable (klass);
- if (mono_class_has_failure (klass))
- goto loader_error;
+ if (mono_class_has_failure (klass)) {
+ mono_error_set_for_class_failure (&error, klass);
+ goto failure;
+ }
iter = NULL;
while ((event = mono_class_get_events (klass, &iter))) {
if (!match)
continue;
- if (name != NULL) {
- if (utf8_name == NULL) {
- utf8_name = mono_string_to_utf8_checked (name, &error);
- if (!is_ok (&error))
- goto failure;
- compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
- }
-
- if (compare_func (event->name, utf8_name))
- continue;
- }
+ if (utf8_name != NULL && compare_func (event->name, utf8_name))
+ continue;
if (g_hash_table_lookup (events, event))
continue;
- MonoReflectionEvent *ev_obj;
- ev_obj = mono_event_get_object_checked (domain, startklass, event, &error);
- if (!ev_obj)
- goto failure;
- mono_ptr_array_append (tmp_array, ev_obj);
+ g_ptr_array_add (res_array, event);
g_hash_table_insert (events, event, event);
}
g_hash_table_destroy (events);
- res = mono_array_new_cached (domain, mono_class_get_event_info_class (), mono_ptr_array_size (tmp_array), &error);
- if (!is_ok (&error))
- goto failure;
-
- for (i = 0; i < mono_ptr_array_size (tmp_array); ++i)
- mono_array_setref (res, i, mono_ptr_array_get (tmp_array, i));
-
- mono_ptr_array_destroy (tmp_array);
-
- if (utf8_name != NULL)
- g_free (utf8_name);
-
- return res;
-
-loader_error:
- if (mono_class_has_failure (klass))
- mono_error_set_for_class_failure (&error, klass);
+ return res_array;
failure:
-
if (events != NULL)
g_hash_table_destroy (events);
- if (utf8_name != NULL)
- g_free (utf8_name);
- mono_ptr_array_destroy (tmp_array);
+ g_ptr_array_free (res_array, TRUE);
mono_error_set_pending_exception (&error);
return NULL;
}
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetNestedTypes (MonoReflectionType *type, MonoString *name, guint32 bflags)
+ICALL_EXPORT GPtrArray *
+ves_icall_RuntimeType_GetNestedTypes_native (MonoReflectionType *type, char *str, guint32 bflags)
{
- MonoError error;
- MonoReflectionType *rt;
- MonoDomain *domain;
MonoClass *klass;
- MonoArray *res = NULL;
- int i, match;
+ int match;
MonoClass *nested;
gpointer iter;
- char *str = NULL;
- MonoPtrArray tmp_array;
+ GPtrArray *res_array;
- mono_error_init (&error);
-
- domain = ((MonoObject *)type)->vtable->domain;
if (type->type->byref) {
- MonoArray *result = mono_array_new_cached (domain, mono_defaults.runtimetype_class, 0, &error);
- mono_error_set_pending_exception (&error);
- return result;
+ return g_ptr_array_new ();
}
+
klass = mono_class_from_mono_type (type->type);
/*
if (klass->generic_class)
klass = klass->generic_class->container_class;
- mono_ptr_array_init (tmp_array, 1, MONO_ROOT_SOURCE_REFLECTION, "temporary reflection nested types list");
+ res_array = g_ptr_array_new ();
+
iter = NULL;
while ((nested = mono_class_get_nested_types (klass, &iter))) {
match = 0;
if (!match)
continue;
- if (name != NULL) {
- if (str == NULL) {
- str = mono_string_to_utf8_checked (name, &error);
- if (!is_ok (&error))
- goto leave;
- mono_identifier_unescape_type_name_chars (str);
- }
-
- if (strcmp (nested->name, str))
+ if (str != NULL && strcmp (nested->name, str))
continue;
- }
- rt = mono_type_get_object_checked (domain, &nested->byval_arg, &error);
- if (!is_ok (&error))
- goto leave;
-
- mono_ptr_array_append (tmp_array, (MonoObject*) rt);
+ g_ptr_array_add (res_array, &nested->byval_arg);
}
- res = mono_array_new_cached (domain, mono_defaults.runtimetype_class, mono_ptr_array_size (tmp_array), &error);
- if (!is_ok (&error))
- goto leave;
-
- for (i = 0; i < mono_ptr_array_size (tmp_array); ++i)
- mono_array_setref (res, i, mono_ptr_array_get (tmp_array, i));
-
-leave:
- mono_ptr_array_destroy (tmp_array);
-
- g_free (str);
-
- mono_error_set_pending_exception (&error);
- return res;
+ return res_array;
}
ICALL_EXPORT MonoReflectionType*
mono_metadata_decode_row (table, i - 1, file_cols, MONO_FILE_SIZE);
val = mono_metadata_string_heap (assembly->assembly->image, file_cols [MONO_FILE_NAME]);
MONO_OBJECT_SETREF (info, filename, mono_string_new (mono_object_domain (assembly), val));
- if (file_cols [MONO_FILE_FLAGS] && FILE_CONTAINS_NO_METADATA)
+ if (file_cols [MONO_FILE_FLAGS] & FILE_CONTAINS_NO_METADATA)
info->location = 0;
else
info->location = RESOURCE_LOCATION_EMBEDDED;
for (i = 0; i < file_count; ++i, ++j) {
mono_metadata_decode_row (table, i, cols, MONO_FILE_SIZE);
- if (cols [MONO_FILE_FLAGS] && FILE_CONTAINS_NO_METADATA) {
+ if (cols [MONO_FILE_FLAGS] & FILE_CONTAINS_NO_METADATA) {
MonoReflectionModule *rm = mono_module_file_get_object_checked (domain, image, i, &error);
if (mono_error_set_pending_exception (&error))
return NULL;
}
ICALL_EXPORT MonoReflectionMethod*
-ves_icall_System_Reflection_MethodBase_GetMethodFromHandleInternalType (MonoMethod *method, MonoType *type)
+ves_icall_System_Reflection_MethodBase_GetMethodFromHandleInternalType_native (MonoMethod *method, MonoType *type, MonoBoolean generic_check)
{
MonoReflectionMethod *res = NULL;
MonoError error;
MonoClass *klass;
- if (type) {
+ if (type && generic_check) {
klass = mono_class_from_mono_type (type);
- if (mono_class_get_generic_type_definition (method->klass) != mono_class_get_generic_type_definition (klass))
+ if (mono_class_get_generic_type_definition (method->klass) != mono_class_get_generic_type_definition (klass))
return NULL;
+
if (method->klass != klass) {
method = mono_method_get_equivalent_method (method, klass);
if (!method)
return NULL;
}
- } else
+ } else if (type)
+ klass = mono_class_from_mono_type (type);
+ else
klass = method->klass;
res = mono_method_get_object_checked (mono_domain_get (), method, klass, &error);
mono_error_set_pending_exception (&error);