|
|
|
@ -1,4 +1,5 @@
@@ -1,4 +1,5 @@
|
|
|
|
|
using CppSharp.AST; |
|
|
|
|
using System.Linq; |
|
|
|
|
using CppSharp.AST; |
|
|
|
|
using CppSharp.AST.Extensions; |
|
|
|
|
|
|
|
|
|
namespace CppSharp.Passes |
|
|
|
@ -7,20 +8,22 @@ namespace CppSharp.Passes
@@ -7,20 +8,22 @@ namespace CppSharp.Passes
|
|
|
|
|
{ |
|
|
|
|
public override bool VisitFunctionDecl(Function function) |
|
|
|
|
{ |
|
|
|
|
if (!function.IsOperator) |
|
|
|
|
{ |
|
|
|
|
ChangeToInterfaceType(function.ReturnType); |
|
|
|
|
foreach (Parameter parameter in function.Parameters) |
|
|
|
|
if (!function.IsOperator || function.Parameters.Count > 1) |
|
|
|
|
ChangeToInterfaceType(function.OriginalReturnType); |
|
|
|
|
|
|
|
|
|
if (function.OperatorKind != CXXOperatorKind.Conversion && |
|
|
|
|
function.OperatorKind != CXXOperatorKind.ExplicitConversion) |
|
|
|
|
{ |
|
|
|
|
foreach (var parameter in function.Parameters.Where(p => p.Kind != ParameterKind.OperatorParameter)) |
|
|
|
|
ChangeToInterfaceType(parameter.QualifiedType); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return base.VisitFunctionDecl(function); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void ChangeToInterfaceType(QualifiedType type) |
|
|
|
|
{ |
|
|
|
|
var tagType = type.Type.GetFinalPointee() as TagType; |
|
|
|
|
var tagType = (type.Type.GetFinalPointee() ?? type.Type) as TagType; |
|
|
|
|
if (tagType != null) |
|
|
|
|
{ |
|
|
|
|
var @class = tagType.Declaration as Class; |
|
|
|
|