private ImmutableArray<TypeParameterSymbol> LoadTypeParameters(ref DiagnosticInfo diagnosticInfo)
{
try
{
var moduleSymbol = _containingType.ContainingPEModule;
var gpHandles = moduleSymbol.Module.GetGenericParametersForMethodOrThrow(_handle);
if (gpHandles.Count == 0)
{
return ImmutableArray<TypeParameterSymbol>.Empty;
}
else
{
var ownedParams = ImmutableArray.CreateBuilder<TypeParameterSymbol>(gpHandles.Count);
for (int i = 0; i < gpHandles.Count; i++)
{
ownedParams.Add(new PETypeParameterSymbol(moduleSymbol, this, (ushort)i, gpHandles[i]));
}
return ownedParams.ToImmutable();
}
}
catch (BadImageFormatException)
{
//diagnosticInfo = new CSDiagnosticInfo(ErrorCode.ERR_BindToBogus, this); // TODO: ErrorCode
return ImmutableArray<TypeParameterSymbol>.Empty;
}
}