Browse Source

Fixed a crash at generation time with a fake "setter" with no params and a getter.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/518/merge
Dimitar Dobrev 10 years ago
parent
commit
8e2490394d
  1. 2
      src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs
  2. 6
      tests/CSharpTemp/CSharpTemp.Tests.cs
  3. 9
      tests/CSharpTemp/CSharpTemp.cpp
  4. 3
      tests/CSharpTemp/CSharpTemp.h

2
src/Generator/Passes/GetterSetterToPropertyAdvancedPass.cs

@ -222,7 +222,7 @@ namespace CppSharp.Passes
{ {
if (method.Parameters.Count == 1) if (method.Parameters.Count == 1)
setters.Add(method); setters.Add(method);
else else if (method.Parameters.Count > 1)
setMethods.Add(method); setMethods.Add(method);
} }
else else

6
tests/CSharpTemp/CSharpTemp.Tests.cs

@ -21,7 +21,11 @@ public class CSharpTempTests : GeneratorTestFixture
new InheritsProtectedVirtualFromSecondaryBase().Dispose(); new InheritsProtectedVirtualFromSecondaryBase().Dispose();
new InheritanceBuffer().Dispose(); new InheritanceBuffer().Dispose();
new HasProtectedVirtual().Dispose(); new HasProtectedVirtual().Dispose();
CSharpTemp.CSharpTemp.FreeFunctionWithUnsupportedDefaultArg(); using (var foo = new Foo())
{
var isNoParams = foo.IsNoParams;
foo.SetNoParams();
}
} }
[Test] [Test]

9
tests/CSharpTemp/CSharpTemp.cpp

@ -26,6 +26,15 @@ int& Foo::operator[](int i)
return P; return P;
} }
bool Foo::isNoParams()
{
return false;
}
void Foo::setNoParams()
{
}
const Foo& Bar::operator[](int i) const const Foo& Bar::operator[](int i) const
{ {
return m_foo; return m_foo;

3
tests/CSharpTemp/CSharpTemp.h

@ -11,7 +11,8 @@ public:
int& operator[](int i); int& operator[](int i);
int A; int A;
int* (*functionPtrReturnsPtrParam)(); int* (*functionPtrReturnsPtrParam)();
int (STDCALL *attributedFunctionPtr)(); bool isNoParams();
void setNoParams();
static const int rename = 5; static const int rename = 5;

Loading…
Cancel
Save