Permalink
Browse files

Simplified the generation of C# for property setters.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
  • Loading branch information...
ddobrev committed Aug 21, 2017
1 parent f33b162 commit faa9512a84b0af4914efb804a7ca3b58db8a8e15
Showing with 9 additions and 15 deletions.
  1. +9 −15 src/Generator/Generators/CSharp/CSharpSources.cs
@@ -816,22 +816,16 @@ private void GenerateFunctionSetter(Class @class, Property property)
if (!property.Type.Equals(param.Type) && property.Type.IsEnumType())
param.Name = "&" + param.Name;
var function = property.SetMethod;
var method = function as Method;
if (function.SynthKind == FunctionSynthKind.AbstractImplCall)
GenerateVirtualPropertyCall(method, @class.BaseClass, property,
new List<Parameter> { param });
else if (method != null && method.IsVirtual)
GenerateVirtualPropertyCall(method, @class, property, new List<Parameter> { param });
else if (method != null && method.OperatorKind == CXXOperatorKind.Subscript)
{
if (method.OperatorKind == CXXOperatorKind.Subscript)
GenerateIndexerSetter(method);
else
GenerateInternalFunctionCall(property.SetMethod, new List<Parameter> { param });
}
var parameters = new List<Parameter> { param };
if (property.SetMethod.SynthKind == FunctionSynthKind.AbstractImplCall)
GenerateVirtualPropertyCall(property.SetMethod, @class.BaseClass,
property, parameters);
else if (property.SetMethod.IsVirtual)
GenerateVirtualPropertyCall(property.SetMethod, @class, property, parameters);
else if (property.SetMethod.OperatorKind == CXXOperatorKind.Subscript)
GenerateIndexerSetter(property.SetMethod);
else
GenerateInternalFunctionCall(function, new List<Parameter> { param });
GenerateInternalFunctionCall(property.SetMethod, parameters);
}
private void GenerateFieldSetter(Field field, Class @class)

0 comments on commit faa9512

Please sign in to comment.