From 8312ff0a20bd6e966e26d0c384a2ad1e5cd285e3 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Tue, 20 Aug 2013 00:30:26 +0300 Subject: [PATCH] Removed the hard-coded "ret" variable. Signed-off-by: Dimitar Dobrev --- .../Generators/CSharp/CSharpTextTemplate.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index 25a04d1b..b73f595f 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -28,7 +28,7 @@ namespace CppSharp.Generators.CSharp public static string GeneratedIdentifier(string id) { - return "_" + id; + return "__" + id; } public static string SafeIdentifier(string id) @@ -1637,7 +1637,7 @@ namespace CppSharp.Generators.CSharp Class retClass = null; hiddenParam.Type.Desugar().IsTagDecl(out retClass); - WriteLine("var __ret = new {0}.Internal();", QualifiedIdentifier(retClass)); + WriteLine("var {0} = new {1}.Internal();", GeneratedIdentifier("ret"), QualifiedIdentifier(retClass)); } var names = new List(); @@ -1654,7 +1654,7 @@ namespace CppSharp.Generators.CSharp if (function.HasHiddenStructParameter) { - var name = string.Format("new IntPtr(&__ret)"); + var name = string.Format("new IntPtr(&{0})", GeneratedIdentifier("ret")); names.Insert(0, name); } @@ -1673,7 +1673,7 @@ namespace CppSharp.Generators.CSharp } if (needsReturn && !function.HasHiddenStructParameter) - Write("var __ret = "); + Write("var {0} = ", GeneratedIdentifier("ret")); WriteLine("{0}({1});", functionName, string.Join(", ", names)); @@ -1704,8 +1704,8 @@ namespace CppSharp.Generators.CSharp { var ctx = new CSharpMarshalContext(Driver) { - ArgName = "__ret", - ReturnVarName = "__ret", + ArgName = GeneratedIdentifier("ret"), + ReturnVarName = GeneratedIdentifier("ret"), ReturnType = retType };