Array overloads with count=1 should be turned into ref/out parameters.

This fixes an issue where arrays with count=1 would remain as unsafe
pointers instead of becoming ref/out parameters.
This commit is contained in:
Stefanos A. 2013-10-22 13:41:31 +02:00
parent a23b846800
commit 9685f6e2f0
2 changed files with 682 additions and 534 deletions

View file

@ -341,11 +341,22 @@ namespace Bind
// Array overloads
foreach (Parameter p in _this.Parameters)
{
if (p.WrapperType == WrapperTypes.ArrayParameter && p.ElementCount != 1)
if (p.WrapperType == WrapperTypes.ArrayParameter)
{
p.Reference = false;
p.Array++;
p.Pointer--;
if (p.ElementCount != 1)
{
// Create a proper array
p.Reference = false;
p.Array++;
p.Pointer--;
}
else
{
// Create a reference
p.Reference = true;
p.Array--;
p.Pointer--;
}
}
}
f = new Function(_this);
@ -373,7 +384,7 @@ namespace Bind
_this = func;
// Pointer overloads
// Should be last to work around Intellisense bug, where
// Should be last to work around an Intellisense bug, where
// array overloads are not reported if there is a pointer overload.
foreach (Parameter p in _this.Parameters)
{

File diff suppressed because it is too large Load diff