Permalink
Browse files

Passed the qualified return type when calling internal functions in C#.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
  • Loading branch information...
ddobrev committed Aug 5, 2017
1 parent 8d518fb commit 787798f2bdc2670f472719c39b29d7ab50f2dc32
Showing with 9 additions and 8 deletions.
  1. +9 −8 src/Generator/Generators/CSharp/CSharpSources.cs
@@ -1068,7 +1068,7 @@ private void GenerateFunctionGetter(Class @class, Property property)
else if (property.GetMethod.IsVirtual)
GenerateVirtualPropertyCall(property.GetMethod, @class, property);
else GenerateInternalFunctionCall(property.GetMethod,
property.GetMethod.Parameters, property.QualifiedType.Type);
property.GetMethod.Parameters, property.QualifiedType);
}
private static Property GetActualProperty(Property property, Class c)
@@ -2574,7 +2574,8 @@ private void GenerateClassConstructor(Method method, Class @class)
}
public void GenerateInternalFunctionCall(Function function,
List<Parameter> parameters = null, Type returnType = null)
List<Parameter> parameters = null,
QualifiedType returnType = default(QualifiedType))
{
if (parameters == null)
parameters = function.Parameters;
@@ -2595,7 +2596,7 @@ private void GenerateClassConstructor(Method method, Class @class)
}
public void GenerateFunctionCall(string functionName, List<Parameter> parameters,
Function function, Type returnType = null)
Function function, QualifiedType returnType = default(QualifiedType))
{
if (function.IsPure)
{
@@ -2604,8 +2605,8 @@ private void GenerateClassConstructor(Method method, Class @class)
}
var retType = function.OriginalReturnType;
if (returnType == null)
returnType = retType.Type;
if (returnType.Type == null)
returnType = retType;
var method = function as Method;
var hasThisReturnStructor = method != null && (method.IsConstructor || method.IsDestructor);
@@ -2752,7 +2753,7 @@ into context
{
ArgName = Helpers.ReturnIdentifier,
ReturnVarName = Helpers.ReturnIdentifier,
ReturnType = retType,
ReturnType = returnType,
Parameter = operatorParam
};
@@ -2768,8 +2769,8 @@ into context
// Special case for indexer - needs to dereference if the internal
// function is a pointer type and the property is not.
if (retType.Type.IsAddress() &&
retType.Type.GetPointee().Equals(returnType) &&
returnType.IsPrimitiveType())
retType.Type.GetPointee().Equals(returnType.Type) &&
returnType.Type.IsPrimitiveType())
WriteLine("return *{0};", marshal.Context.Return);
else
WriteLine("return {0};", marshal.Context.Return);

0 comments on commit 787798f

Please sign in to comment.