mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-06-21 11:37:54 +00:00
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
|
@ -627,8 +627,12 @@ namespace Bind
|
||||||
|
|
||||||
if (!f.CLSCompliant)
|
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;
|
bool modified = false;
|
||||||
for (int i = 0; i < f.Parameters.Count; i++)
|
for (int i = 0; i < f.Parameters.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -637,8 +641,12 @@ namespace Bind
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only add a cls-compliant overload if we have
|
||||||
|
// changed a parameter.
|
||||||
if (modified)
|
if (modified)
|
||||||
|
{
|
||||||
wrappers.AddChecked(cls);
|
wrappers.AddChecked(cls);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue