Browse Source

Fixed the generation of v-table delegates to take into account indirect return types.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/94/head
Dimitar Dobrev 12 years ago
parent
commit
56385a453f
  1. 9
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

9
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -536,7 +536,7 @@ namespace CppSharp.Generators.CSharp
TypePrinter.PushContext(CSharpTypePrinterContextKind.Native); TypePrinter.PushContext(CSharpTypePrinterContextKind.Native);
var retParam = new Parameter { QualifiedType = function.ReturnType }; var retParam = new Parameter { QualifiedType = function.OriginalReturnType };
retType = retParam.CSharpType(TypePrinter); retType = retParam.CSharpType(TypePrinter);
var method = function as Method; var method = function as Method;
@ -1285,8 +1285,7 @@ namespace CppSharp.Generators.CSharp
marshals.Add(marshal.Context.Return); marshals.Add(marshal.Context.Return);
} }
var hasReturn = !method.ReturnType.Type.IsPrimitiveType(PrimitiveType.Void) var hasReturn = !method.OriginalReturnType.Type.IsPrimitiveType(PrimitiveType.Void);
&& !method.HasIndirectReturnTypeParameter;
if (hasReturn) if (hasReturn)
Write("var _ret = "); Write("var _ret = ");
@ -1300,8 +1299,6 @@ namespace CppSharp.Generators.CSharp
InvokeProperty(method, marshals); InvokeProperty(method, marshals);
} }
// TODO: Handle hidden structure return types.
if (hasReturn) if (hasReturn)
{ {
var param = new Parameter var param = new Parameter
@ -1319,7 +1316,7 @@ namespace CppSharp.Generators.CSharp
}; };
var marshal = new CSharpMarshalManagedToNativePrinter(ctx); var marshal = new CSharpMarshalManagedToNativePrinter(ctx);
method.ReturnType.Visit(marshal); method.OriginalReturnType.Visit(marshal);
if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore)) if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore))
Write(marshal.Context.SupportBefore); Write(marshal.Context.SupportBefore);

Loading…
Cancel
Save