Imported Upstream version 4.8.0.371

Former-commit-id: 1cedda3b6a8e480191a7a40a8dc33eb078fba58b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-11-28 21:01:12 +00:00
parent 62edeef69b
commit 069517201b
48 changed files with 181 additions and 50 deletions

View File

@@ -365,7 +365,7 @@ namespace Mono.CSharp
// }
//
if (!IsMissingType (type) && type.IsGenericTypeDefinition) {
var start_pos = spec.DeclaringType == null ? 0 : spec.DeclaringType.MemberDefinition.TypeParametersCount;
var start_pos = GetDeclaringTypesTypeParametersCount (spec);
var targs = CreateGenericArguments (start_pos, type.GetGenericArguments (), dtype);
spec = spec.MakeGenericType (module, targs);
}
@@ -381,6 +381,17 @@ namespace Mono.CSharp
return tspec;
}
static int GetDeclaringTypesTypeParametersCount (TypeSpec spec)
{
int total = 0;
while (spec.DeclaringType != null) {
total += spec.DeclaringType.MemberDefinition.TypeParametersCount;
spec = spec.DeclaringType;
}
return total;
}
public MethodSpec CreateMethod (MethodBase mb, TypeSpec declaringType)
{
Modifiers mod = ReadMethodModifiers (mb, declaringType);