- container = method->generic_container;
- g_assert (container);
-
- gmethod = g_new0 (MonoGenericMethod, 1);
- gmethod->generic_class = method->klass->generic_class;
- gmethod->container = container;
-
- new_context = g_new0 (MonoGenericContext, 1);
- new_context->container = container;
- new_context->gmethod = gmethod;
- if (container->parent)
- new_context->gclass = container->parent->context.gclass;
-
- /*
- * When parsing the methodspec signature, we're in the old context again:
- *
- * ----------------------------------------
- * class Foo {
- * static void Hello<T> (T t) { }
- *
- * static void Test<U> (U u) {
- * Foo.Hello<U> (u);
- * }
- * }
- * ----------------------------------------
- *
- * Let's assume we're currently JITing "Foo.Test<float>".
- *
- * In this case, we already parsed the memberref as "Foo.Hello<T>" and the methodspec
- * signature is "<!!0>". This means that we must instantiate the method type parameter
- * `T' from the new method with the method type parameter `U' from the current context;
- * ie. instantiate the method as `Foo.Hello<float>.
- */
-
- gmethod->inst = mono_metadata_parse_generic_inst (image, context ? context->container : NULL, param_count, ptr, &ptr);
-
- if (context && gmethod->inst->is_open)
- gmethod->inst = mono_metadata_inflate_generic_inst (gmethod->inst, context);