private static TypeReference ImportGenericParameter(Type type, ImportGenericContext context)
{
if (context.IsEmpty)
{
throw new InvalidOperationException();
}
if (type.DeclaringMethod != null)
{
return(context.MethodParameter(type.DeclaringMethod.Name, type.GenericParameterPosition));
}
if (type.DeclaringType == null)
{
throw new InvalidOperationException();
}
return(context.TypeParameter(NormalizedFullName(type.DeclaringType), type.GenericParameterPosition));
}