|
|
|
@ -1,5 +1,4 @@ |
|
|
|
using System.Linq; |
|
|
|
using CppSharp.AST; |
|
|
|
using CppSharp.AST; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace CppSharp.Passes |
|
|
|
namespace CppSharp.Passes |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -9,25 +8,16 @@ namespace CppSharp.Passes |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!function.IsOperator) |
|
|
|
if (!function.IsOperator) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (function.HasIndirectReturnTypeParameter) |
|
|
|
ChangeToInterfaceType(function.ReturnType); |
|
|
|
|
|
|
|
foreach (Parameter parameter in function.Parameters) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var parameter = function.Parameters.Find(p => p.Kind == ParameterKind.IndirectReturnType); |
|
|
|
ChangeToInterfaceType(parameter.QualifiedType); |
|
|
|
parameter.QualifiedType = GetInterfaceType(parameter.QualifiedType); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
function.ReturnType = GetInterfaceType(function.ReturnType); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
foreach (Parameter parameter in function.Parameters.Where( |
|
|
|
|
|
|
|
p => p.Kind != ParameterKind.IndirectReturnType)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
parameter.QualifiedType = GetInterfaceType(parameter.QualifiedType); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return base.VisitFunctionDecl(function); |
|
|
|
return base.VisitFunctionDecl(function); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static QualifiedType GetInterfaceType(QualifiedType type) |
|
|
|
private static void ChangeToInterfaceType(QualifiedType type) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var tagType = type.Type as TagType; |
|
|
|
var tagType = type.Type as TagType; |
|
|
|
if (tagType == null) |
|
|
|
if (tagType == null) |
|
|
|
@ -43,10 +33,9 @@ namespace CppSharp.Passes |
|
|
|
{ |
|
|
|
{ |
|
|
|
var @interface = @class.Namespace.Classes.Find(c => c.OriginalClass == @class); |
|
|
|
var @interface = @class.Namespace.Classes.Find(c => c.OriginalClass == @class); |
|
|
|
if (@interface != null) |
|
|
|
if (@interface != null) |
|
|
|
return new QualifiedType(new TagType(@interface)); |
|
|
|
tagType.Declaration = @interface; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return type; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|