Browse Source

Fixed the generation of fields of a type def type by correctly desugaring.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/74/head
Dimitar Dobrev 12 years ago
parent
commit
444a6e639f
  1. 5
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs
  2. 11
      tests/CSharpTemp/CSharpTemp.h

5
src/Generator/Generators/CSharp/CSharpTypePrinter.cs

@ -179,7 +179,8 @@ namespace CppSharp.Generators.CSharp
return isManagedContext ? "string" : "global::System.IntPtr"; return isManagedContext ? "string" : "global::System.IntPtr";
PrimitiveType primitive; PrimitiveType primitive;
if (pointee.Desugar().IsPrimitiveType(out primitive)) var desugared = pointee.Desugar();
if (desugared.IsPrimitiveType(out primitive))
{ {
if (isManagedContext && Context.Parameter != null && if (isManagedContext && Context.Parameter != null &&
(Context.Parameter.IsOut || Context.Parameter.IsInOut)) (Context.Parameter.IsOut || Context.Parameter.IsInOut))
@ -191,7 +192,7 @@ namespace CppSharp.Generators.CSharp
} }
Class @class; Class @class;
if (pointee.IsTagDecl(out @class) if (desugared.IsTagDecl(out @class)
&& ContextKind == CSharpTypePrinterContextKind.Native) && ContextKind == CSharpTypePrinterContextKind.Native)
{ {
return "global::System.IntPtr"; return "global::System.IntPtr";

11
tests/CSharpTemp/CSharpTemp.h

@ -51,3 +51,14 @@ public:
typedef void *Baz::*FunctionPointerResolvedAsVoidStar; typedef void *Baz::*FunctionPointerResolvedAsVoidStar;
operator FunctionPointerResolvedAsVoidStar() const { return 0; } operator FunctionPointerResolvedAsVoidStar() const { return 0; }
}; };
struct QArrayData
{
};
typedef QArrayData QByteArrayData;
struct QByteArrayDataPtr
{
QByteArrayData* ptr;
};

Loading…
Cancel
Save