From 56385a453fe58e4df8e88a865946124be8498c12 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Fri, 1 Nov 2013 23:28:28 +0200 Subject: [PATCH] Fixed the generation of v-table delegates to take into account indirect return types. Signed-off-by: Dimitar Dobrev --- src/Generator/Generators/CSharp/CSharpTextTemplate.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index b0a5fc4b..9d9467b1 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -536,7 +536,7 @@ namespace CppSharp.Generators.CSharp TypePrinter.PushContext(CSharpTypePrinterContextKind.Native); - var retParam = new Parameter { QualifiedType = function.ReturnType }; + var retParam = new Parameter { QualifiedType = function.OriginalReturnType }; retType = retParam.CSharpType(TypePrinter); var method = function as Method; @@ -1285,8 +1285,7 @@ namespace CppSharp.Generators.CSharp marshals.Add(marshal.Context.Return); } - var hasReturn = !method.ReturnType.Type.IsPrimitiveType(PrimitiveType.Void) - && !method.HasIndirectReturnTypeParameter; + var hasReturn = !method.OriginalReturnType.Type.IsPrimitiveType(PrimitiveType.Void); if (hasReturn) Write("var _ret = "); @@ -1300,8 +1299,6 @@ namespace CppSharp.Generators.CSharp InvokeProperty(method, marshals); } - // TODO: Handle hidden structure return types. - if (hasReturn) { var param = new Parameter @@ -1319,7 +1316,7 @@ namespace CppSharp.Generators.CSharp }; var marshal = new CSharpMarshalManagedToNativePrinter(ctx); - method.ReturnType.Visit(marshal); + method.OriginalReturnType.Visit(marshal); if (!string.IsNullOrWhiteSpace(marshal.Context.SupportBefore)) Write(marshal.Context.SupportBefore);