Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
@ -60,6 +60,10 @@ namespace CppSharp.Generators.CSharp
default:
return new CSharpExpressionPrinterResult { Value = expr.String };
}
case StatementClass.DeclarationReference:
if (expr.Declaration is Variable)
return new CSharpExpressionPrinterResult { Value = expr.Declaration.Name };
goto default;
@ -6,7 +6,7 @@ using CppSharp.Utils;
using CSharp;
using NUnit.Framework;
public class CSharpTests : GeneratorTestFixture
public unsafe class CSharpTests : GeneratorTestFixture
{
public class ExtendsWrapper : TestOverrideFromSecondaryBase
@ -210,6 +210,7 @@ public class CSharpTests : GeneratorTestFixture
methodsWithDefaultValues.DefaultWithFunctionCall();
methodsWithDefaultValues.DefaultWithPropertyCall();
methodsWithDefaultValues.DefaultWithGetPropertyCall();
methodsWithDefaultValues.DefaultWithStringConstant();
@ -1,6 +1,6 @@
#include "CSharp.h"
Foo::Foo()
Foo::Foo(char* name)
A = 10;
P = 50;
@ -381,6 +381,8 @@ MethodsWithDefaultValues::QMargins::QMargins(int left, int top, int right, int b
char* MethodsWithDefaultValues::stringConstant = "test";
MethodsWithDefaultValues::MethodsWithDefaultValues(Foo foo)
m_foo = foo;
@ -535,6 +537,10 @@ void MethodsWithDefaultValues::defaultWithGetPropertyCall(int f)
void MethodsWithDefaultValues::defaultWithStringConstant(const Foo& arg)
int MethodsWithDefaultValues::getA()
return m_foo.A;
@ -5,7 +5,7 @@
class DLL_API Foo
public:
Foo();
Foo(char* name = 0);
Foo(int a, int p = 0);
int method();
int operator[](int i) const;
@ -340,6 +340,8 @@ public:
QMargins(int left, int top, int right, int bottom);
};
static char* stringConstant;
MethodsWithDefaultValues(Foo foo = Foo());
MethodsWithDefaultValues(int a);
MethodsWithDefaultValues(double d, QList<QColor> list = QList<QColor>());
@ -382,6 +384,7 @@ public:
void defaultWithFunctionCall(int f = Foo::makeFunctionCall());
void defaultWithPropertyCall(int f = Foo::propertyCall());
void defaultWithGetPropertyCall(int f = Foo::getGetPropertyCall());
void defaultWithStringConstant(const Foo& arg = Foo(stringConstant));
int getA();
private:
Foo m_foo;