Browse Source

Fixed the names when marshalling enum parameters in the C# end.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/516/head
Dimitar Dobrev 10 years ago
parent
commit
86bd6bd118
  1. 4
      src/Generator/Generators/CSharp/CSharpMarshal.cs
  2. 1
      tests/Basic/Basic.Tests.cs
  3. 2
      tests/Basic/Basic.cpp
  4. 2
      tests/Basic/Basic.h

4
src/Generator/Generators/CSharp/CSharpMarshal.cs

@ -528,7 +528,7 @@ namespace CppSharp.Generators.CSharp @@ -528,7 +528,7 @@ namespace CppSharp.Generators.CSharp
case PrimitiveType.Float:
case PrimitiveType.Double:
case PrimitiveType.WideChar:
Context.Return.Write(Helpers.SafeIdentifier(Context.Parameter.Name));
Context.Return.Write(Context.Parameter.Name);
return true;
case PrimitiveType.Char16:
return false;
@ -647,7 +647,7 @@ namespace CppSharp.Generators.CSharp @@ -647,7 +647,7 @@ namespace CppSharp.Generators.CSharp
public override bool VisitEnumDecl(Enumeration @enum)
{
Context.Return.Write(Helpers.SafeIdentifier(Context.Parameter.Name));
Context.Return.Write(Context.Parameter.Name);
return true;
}

1
tests/Basic/Basic.Tests.cs

@ -181,6 +181,7 @@ public class BasicTests : GeneratorTestFixture @@ -181,6 +181,7 @@ public class BasicTests : GeneratorTestFixture
{
var foo2 = new Foo2 {C = 2};
Foo2 result = foo2 << 3;
foo2.testKeywordParam(IntPtr.Zero, Bar.Item.Item1, 1);
Assert.That(result.C, Is.EqualTo(16));
}

2
tests/Basic/Basic.cpp

@ -49,7 +49,7 @@ char Foo2::testCharMarshalling(char c) @@ -49,7 +49,7 @@ char Foo2::testCharMarshalling(char c)
return c;
}
void Foo2::testKeywordParam(void* where)
void Foo2::testKeywordParam(void* where, Bar::Item event, int ref)
{
}

2
tests/Basic/Basic.h

@ -75,7 +75,7 @@ public: @@ -75,7 +75,7 @@ public:
Foo2 operator<<(signed long l);
Bar valueTypeField;
char testCharMarshalling(char c);
void testKeywordParam(void* where);
void testKeywordParam(void* where, Bar::Item event, int ref);
};
DLL_API Bar::Item operator |(Bar::Item left, Bar::Item right);

Loading…
Cancel
Save