* token is the method_ref or method_def token used in a call IL instruction.
*/
MonoMethodSignature*
-mono_method_get_signature (MonoMethod *method, MonoImage *image, guint32 token)
+mono_method_get_signature_full (MonoMethod *method, MonoImage *image, guint32 token, MonoGenericContext *context)
{
int table = mono_metadata_token_table (token);
int idx = mono_metadata_token_index (token);
ptr = mono_metadata_blob_heap (image, cols [MONO_MEMBERREF_SIGNATURE]);
mono_metadata_decode_blob_size (ptr, &ptr);
- sig = mono_metadata_parse_method_signature (image, 0, ptr, NULL);
+ sig = mono_metadata_parse_method_signature_full (image, context, 0, ptr, NULL);
g_hash_table_insert (image->memberref_signatures, GUINT_TO_POINTER (token), sig);
}
+ sig = mono_class_inflate_generic_signature (image, sig, context);
+
return sig;
}
+MonoMethodSignature*
+mono_method_get_signature (MonoMethod *method, MonoImage *image, guint32 token)
+{
+ return mono_method_get_signature_full (method, image, token, NULL);
+}
+
static MonoMethod *
method_from_memberref (MonoImage *image, guint32 idx, MonoGenericContext *context)
{
ptr = mono_metadata_blob_heap (image, cols [MONO_MEMBERREF_SIGNATURE]);
mono_metadata_decode_blob_size (ptr, &ptr);
- sig = mono_metadata_parse_method_signature_full (image, container, 0, ptr, NULL);
+ sig = mono_metadata_parse_method_signature_full (image, (MonoGenericContext *) container, 0, ptr, NULL);
switch (class) {
case MONO_MEMBERREF_PARENT_TYPEREF:
g_assert (container && container->is_method);
if (context) {
- if (context->gclass) {
- g_assert (context->gclass->container);
- container->parent = context->gclass->container;
- } else
- container->parent = context->container;
+ g_assert (context->container);
+ container->parent = context->container;
+ if (container->parent->is_method)
+ container->parent = container->parent->parent;
}
gmethod = g_new0 (MonoGenericMethod, 1);
gmethod->container = container;
- gmethod->mtype_argc = param_count;
- gmethod->mtype_argv = g_new0 (MonoType *, param_count);
-
- for (i = 0; i < param_count; i++) {
- MonoType *t = mono_metadata_parse_type_full (
- image, container, MONO_PARSE_TYPE, 0, ptr, &ptr);
- if (context)
- t = mono_class_inflate_generic_type (t, context);
+ gmethod->inst = mono_metadata_parse_generic_inst (
+ image, (MonoGenericContext *) container, param_count, ptr, &ptr);
- gmethod->mtype_argv [i] = t;
-
- if (!gmethod->is_open)
- gmethod->is_open = mono_class_is_open_constructed_type (gmethod->mtype_argv [i]);
- }
+ if (context)
+ gmethod->inst = mono_metadata_inflate_generic_inst (gmethod->inst, context);
if (!container->method_hash)
container->method_hash = g_hash_table_new (
- mono_metadata_generic_method_hash, mono_metadata_generic_method_equal);
+ (GHashFunc)mono_metadata_generic_method_hash, (GEqualFunc)mono_metadata_generic_method_equal);
inflated = g_hash_table_lookup (container->method_hash, gmethod);
if (inflated) {
- g_free (gmethod->mtype_argv);
g_free (gmethod);
-
return inflated;
}
if (!context) {
new_context = g_new0 (MonoGenericContext, 1);
+ new_context->container = container;
new_context->gmethod = gmethod;
context = new_context;
} else {
new_context = g_new0 (MonoGenericContext, 1);
+ new_context->container = container;
new_context->gmethod = gmethod;
new_context->gclass = context->gclass;
if (exc_class) {
*exc_class = "DllNotFoundException";
- *exc_arg = orig_scope;
+ *exc_arg = new_scope;
}
return NULL;
}
if (table != MONO_TABLE_METHOD) {
MonoGenericContainer *generic_container = NULL;
if (context) {
- if (context->gclass) {
- g_assert (context->gclass->container);
- generic_container = context->gclass->container;
- } else
- generic_container = context->container;
+ g_assert (context->container);
+ generic_container = context->container;
}
if (table == MONO_TABLE_METHODSPEC)
return method_from_methodspec (image, context, idx);
if (!sig) /* already taken from the methodref */
sig = mono_metadata_blob_heap (image, cols [4]);
size = mono_metadata_decode_blob_size (sig, &sig);
- result->signature = mono_metadata_parse_method_signature_full (image, container, idx, sig, NULL);
+ result->signature = mono_metadata_parse_method_signature_full (
+ image, (MonoGenericContext *) container, idx, sig, NULL);
if (!result->klass) {
guint32 type = mono_metadata_typedef_from_method (image, token);
!(result->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) && container) {
gpointer loc = mono_image_rva_map (image, cols [0]);
g_assert (loc);
- ((MonoMethodNormal *) result)->header = mono_metadata_parse_mh_full (image, container, loc);
+ ((MonoMethodNormal *) result)->header = mono_metadata_parse_mh_full (
+ image, (MonoGenericContext *) container, loc);
}
((MonoMethodNormal *) result)->generic_container = generic_container;
g_assert (loc);
- mn->header = mono_metadata_parse_mh_full (img, mn->generic_container, loc);
+ mn->header = mono_metadata_parse_mh_full (img, (MonoGenericContext *) mn->generic_container, loc);
mono_loader_unlock ();
return mn->header;