|
|
|
@ -10,6 +10,15 @@ namespace CppSharp.Passes |
|
|
|
{ |
|
|
|
{ |
|
|
|
public override bool VisitClassDecl(Class @class) |
|
|
|
public override bool VisitClassDecl(Class @class) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (@class.CompleteDeclaration != null) |
|
|
|
|
|
|
|
return VisitClassDecl(@class.CompleteDeclaration as Class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!VisitDeclaration(@class)) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (AlreadyVisited(@class)) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
// Check for C++ operators that cannot be represented in C#.
|
|
|
|
// Check for C++ operators that cannot be represented in C#.
|
|
|
|
CheckInvalidOperators(@class); |
|
|
|
CheckInvalidOperators(@class); |
|
|
|
|
|
|
|
|
|
|
|
@ -66,11 +75,17 @@ namespace CppSharp.Passes |
|
|
|
|
|
|
|
|
|
|
|
var existingKind = missingKind == op2 ? op1 : op2; |
|
|
|
var existingKind = missingKind == op2 ? op1 : op2; |
|
|
|
|
|
|
|
|
|
|
|
var overload = @class.FindOperator(existingKind).First(); |
|
|
|
// FIXME: We have to check for missing overloads per overload instance.
|
|
|
|
|
|
|
|
foreach (var overload in @class.FindOperator(existingKind)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (overload.Ignore) continue; |
|
|
|
|
|
|
|
|
|
|
|
var @params = overload.Parameters; |
|
|
|
var @params = overload.Parameters; |
|
|
|
|
|
|
|
|
|
|
|
var method = new Method() |
|
|
|
var method = new Method() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Name = CSharpTextTemplate.GetOperatorIdentifier(missingKind), |
|
|
|
|
|
|
|
Namespace = @class, |
|
|
|
IsSynthetized = true, |
|
|
|
IsSynthetized = true, |
|
|
|
Kind = CXXMethodKind.Operator, |
|
|
|
Kind = CXXMethodKind.Operator, |
|
|
|
OperatorKind = missingKind, |
|
|
|
OperatorKind = missingKind, |
|
|
|
@ -80,6 +95,7 @@ namespace CppSharp.Passes |
|
|
|
|
|
|
|
|
|
|
|
@class.Methods.Insert(index, method); |
|
|
|
@class.Methods.Insert(index, method); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static CXXOperatorKind CheckMissingOperatorOverloadPair(Class @class, |
|
|
|
static CXXOperatorKind CheckMissingOperatorOverloadPair(Class @class, |
|
|
|
out int index, CXXOperatorKind op1, CXXOperatorKind op2) |
|
|
|
out int index, CXXOperatorKind op1, CXXOperatorKind op2) |
|
|
|
|