diff --git a/src/Generator/Generators/CSharp/CSharpExpressionPrinter.cs b/src/Generator/Generators/CSharp/CSharpExpressionPrinter.cs index 6ff5ccf2..6609f528 100644 --- a/src/Generator/Generators/CSharp/CSharpExpressionPrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpExpressionPrinter.cs @@ -50,11 +50,13 @@ namespace CppSharp.Generators.CSharp }; case GenerationKind.Internal: // a non-ctor can only be internal if it's been converted to a property + var property = ((Class) callExpr.Declaration.Namespace).Properties.First( + p => p.GetMethod == callExpr.Declaration); return new CSharpExpressionPrinterResult { Value = string.Format("{0}.{1}", typePrinter.VisitDeclaration(callExpr.Declaration.Namespace), - callExpr.Declaration.Name) + property.Name) }; default: return new CSharpExpressionPrinterResult { Value = expr.String }; diff --git a/tests/CSharp/CSharp.Tests.cs b/tests/CSharp/CSharp.Tests.cs index 3b78f24e..4ff587e9 100644 --- a/tests/CSharp/CSharp.Tests.cs +++ b/tests/CSharp/CSharp.Tests.cs @@ -199,6 +199,7 @@ public class CSharpTests : GeneratorTestFixture methodsWithDefaultValues.DefaultWithRefManagedLong(); methodsWithDefaultValues.DefaultWithFunctionCall(); methodsWithDefaultValues.DefaultWithPropertyCall(); + methodsWithDefaultValues.DefaultWithGetPropertyCall(); } } diff --git a/tests/CSharp/CSharp.cpp b/tests/CSharp/CSharp.cpp index d9f8b2c6..fadba6da 100644 --- a/tests/CSharp/CSharp.cpp +++ b/tests/CSharp/CSharp.cpp @@ -53,6 +53,11 @@ int Foo::propertyCall() return 1; } +int Foo::getGetPropertyCall() +{ + return 1; +} + const Foo& Bar::operator[](int i) const { return m_foo; @@ -502,6 +507,10 @@ void MethodsWithDefaultValues::defaultWithPropertyCall(int f) { } +void MethodsWithDefaultValues::defaultWithGetPropertyCall(int f) +{ +} + int MethodsWithDefaultValues::getA() { return m_foo.A; diff --git a/tests/CSharp/CSharp.h b/tests/CSharp/CSharp.h index 5519abe7..0249b787 100644 --- a/tests/CSharp/CSharp.h +++ b/tests/CSharp/CSharp.h @@ -19,6 +19,7 @@ public: static const int rename = 5; static int makeFunctionCall(); static int propertyCall(); + static int getGetPropertyCall(); protected: int P; @@ -368,6 +369,7 @@ public: void defaultWithRefManagedLong(long long* i = 0); void defaultWithFunctionCall(int f = Foo::makeFunctionCall()); void defaultWithPropertyCall(int f = Foo::propertyCall()); + void defaultWithGetPropertyCall(int f = Foo::getGetPropertyCall()); int getA(); private: Foo m_foo;