From 712a3904a68201758330dd8e8e0dbb9d3fc2e599 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Mon, 19 Aug 2013 22:56:51 +0300 Subject: [PATCH] Removed the "protected" modifier of setters when in a structure. Changed a generated local variable to a non-conflicting name. Signed-off-by: Dimitar Dobrev --- .../Generators/CSharp/CSharpTextTemplate.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index b7c74d81..40e1dfb0 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -324,8 +324,8 @@ namespace CppSharp.Generators.CSharp if (ShouldGenerateClassNativeField(@class)) { PushBlock(CSharpBlockKind.Field); - WriteLine("public global::System.IntPtr {0} {{ get; protected set; }}", - Helpers.InstanceIdentifier); + WriteLine("public global::System.IntPtr {0} {{ get; {1} set; }}", + Helpers.InstanceIdentifier, @class.IsValueType ? "private" : "protected"); PopBlock(NewLineKind.BeforeNextBlock); } @@ -1636,7 +1636,7 @@ namespace CppSharp.Generators.CSharp Class retClass = null; hiddenParam.Type.Desugar().IsTagDecl(out retClass); - WriteLine("var ret = new {0}.Internal();", retClass.OriginalName); + WriteLine("var __ret = new {0}.Internal();", retClass.OriginalName); } var names = new List(); @@ -1653,7 +1653,7 @@ namespace CppSharp.Generators.CSharp if (function.HasHiddenStructParameter) { - var name = string.Format("new IntPtr(&ret)"); + var name = string.Format("new IntPtr(&__ret)"); names.Insert(0, name); } @@ -1672,7 +1672,7 @@ namespace CppSharp.Generators.CSharp } if (needsReturn && !function.HasHiddenStructParameter) - Write("var ret = "); + Write("var __ret = "); WriteLine("{0}({1});", functionName, string.Join(", ", names)); @@ -1703,8 +1703,8 @@ namespace CppSharp.Generators.CSharp { var ctx = new CSharpMarshalContext(Driver) { - ArgName = "ret", - ReturnVarName = "ret", + ArgName = "__ret", + ReturnVarName = "__ret", ReturnType = retType };