Browse Source

Simplified the generation of C# for property setters.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/916/merge
Dimitar Dobrev 8 years ago
parent
commit
faa9512a84
  1. 24
      src/Generator/Generators/CSharp/CSharpSources.cs

24
src/Generator/Generators/CSharp/CSharpSources.cs

@ -816,22 +816,16 @@ namespace CppSharp.Generators.CSharp
if (!property.Type.Equals(param.Type) && property.Type.IsEnumType()) if (!property.Type.Equals(param.Type) && property.Type.IsEnumType())
param.Name = "&" + param.Name; param.Name = "&" + param.Name;
var function = property.SetMethod; var parameters = new List<Parameter> { param };
var method = function as Method; if (property.SetMethod.SynthKind == FunctionSynthKind.AbstractImplCall)
if (function.SynthKind == FunctionSynthKind.AbstractImplCall) GenerateVirtualPropertyCall(property.SetMethod, @class.BaseClass,
GenerateVirtualPropertyCall(method, @class.BaseClass, property, property, parameters);
new List<Parameter> { param }); else if (property.SetMethod.IsVirtual)
else if (method != null && method.IsVirtual) GenerateVirtualPropertyCall(property.SetMethod, @class, property, parameters);
GenerateVirtualPropertyCall(method, @class, property, new List<Parameter> { param }); else if (property.SetMethod.OperatorKind == CXXOperatorKind.Subscript)
else if (method != null && method.OperatorKind == CXXOperatorKind.Subscript) GenerateIndexerSetter(property.SetMethod);
{
if (method.OperatorKind == CXXOperatorKind.Subscript)
GenerateIndexerSetter(method);
else
GenerateInternalFunctionCall(property.SetMethod, new List<Parameter> { param });
}
else else
GenerateInternalFunctionCall(function, new List<Parameter> { param }); GenerateInternalFunctionCall(property.SetMethod, parameters);
} }
private void GenerateFieldSetter(Field field, Class @class) private void GenerateFieldSetter(Field field, Class @class)

Loading…
Cancel
Save