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,12 +341,23 @@ namespace Bind
// Array overloads // Array overloads
foreach (Parameter p in _this.Parameters) foreach (Parameter p in _this.Parameters)
{ {
if (p.WrapperType == WrapperTypes.ArrayParameter && p.ElementCount != 1) if (p.WrapperType == WrapperTypes.ArrayParameter)
{ {
if (p.ElementCount != 1)
{
// Create a proper array
p.Reference = false; p.Reference = false;
p.Array++; p.Array++;
p.Pointer--; p.Pointer--;
} }
else
{
// Create a reference
p.Reference = true;
p.Array--;
p.Pointer--;
}
}
} }
f = new Function(_this); f = new Function(_this);
CreateBody(f, false, enums); CreateBody(f, false, enums);
@ -373,7 +384,7 @@ namespace Bind
_this = func; _this = func;
// Pointer overloads // 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. // array overloads are not reported if there is a pointer overload.
foreach (Parameter p in _this.Parameters) foreach (Parameter p in _this.Parameters)
{ {

File diff suppressed because it is too large Load diff