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:
parent
6098fa05ce
commit
af7fdea449
1 changed files with 9 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue