- /*
- * Be careful with the two contexts here:
- *
- * ----------------------------------------
- * class Foo<S> {
- * static void Hello<T> (S s, T t) { }
- *
- * static void Test<U> (U u) {
- * Foo<U>.Hello<string> (u, "World");
- * }
- * }
- * ----------------------------------------
- *
- * Let's assume we're currently JITing Foo<int>.Test<long>
- * (ie. `S' is instantiated as `int' and `U' is instantiated as `long').
- *
- * The call to Hello() is encoded with a MethodSpec with a TypeSpec as parent
- * (MONO_MEMBERREF_PARENT_TYPESPEC).
- *
- * The TypeSpec is encoded as `Foo<!!0>', so we need to parse it in the current
- * context (S=int, U=long) to get the correct `Foo<long>'.
- *
- * After that, we parse the memberref signature in the new context
- * (S=int, T=uninstantiated) and get the open generic method `Foo<long>.Hello<T>'.
- *
- */
+ inst = mono_metadata_parse_generic_inst (image, NULL, param_count, ptr, &ptr);
+ if (context && inst->is_open)
+ inst = mono_metadata_inflate_generic_inst (inst, context);
+