Return types must be cls-compliant

CreateCLSCompliantWrappers must always change return types into
cls-compliant types. The reason is that we cannot overload on return
type alone, so we should always choose the compliant version.
This commit is contained in:
Stefanos A. 2013-11-10 15:35:47 +01:00
parent 6098fa05ce
commit af7fdea449

View file

@ -627,8 +627,12 @@ namespace Bind
if (!f.CLSCompliant)
{
Function cls = new Function(f);
// The return type must always be cls-compliant,
// since we cannot overload on return types alone.
f.ReturnType.CurrentType = GetCLSCompliantType(f.ReturnType);
// Create a cls-compliant wrapper for the parameters
Function cls = new Function(f);
bool modified = false;
for (int i = 0; i < f.Parameters.Count; i++)
{
@ -637,8 +641,12 @@ namespace Bind
modified = true;
}
// Only add a cls-compliant overload if we have
// changed a parameter.
if (modified)
{
wrappers.AddChecked(cls);
}
}
}
}