|
|
|
|
@ -412,6 +412,36 @@ namespace Cxxi.Generators.CLI
@@ -412,6 +412,36 @@ namespace Cxxi.Generators.CLI
|
|
|
|
|
public bool VisitClassDecl(Class @class) |
|
|
|
|
{ |
|
|
|
|
if (@class.IsValueType) |
|
|
|
|
{ |
|
|
|
|
MarshalValueClass(@class); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (MarshalRefClass()) return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private bool MarshalRefClass() |
|
|
|
|
{ |
|
|
|
|
if (!Context.Parameter.Type.IsPointer()) |
|
|
|
|
Return.Write("*"); |
|
|
|
|
|
|
|
|
|
var method = Context.Function as Method; |
|
|
|
|
if (method != null |
|
|
|
|
&& method.Conversion == MethodConversionKind.FunctionToInstanceMethod |
|
|
|
|
&& Context.ParameterIndex == 0) |
|
|
|
|
{ |
|
|
|
|
Return.Write("NativePtr"); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Return.Write("{0}->NativePtr", Context.Parameter.Name); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void MarshalValueClass(Class @class) |
|
|
|
|
{ |
|
|
|
|
if (Context.Parameter.Type.IsReference()) |
|
|
|
|
{ |
|
|
|
|
@ -447,25 +477,6 @@ namespace Cxxi.Generators.CLI
@@ -447,25 +477,6 @@ namespace Cxxi.Generators.CLI
|
|
|
|
|
ArgumentPrefix.Write("&"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (!Context.Parameter.Type.IsPointer()) |
|
|
|
|
Return.Write("*"); |
|
|
|
|
|
|
|
|
|
var method = Context.Function as Method; |
|
|
|
|
if (method != null |
|
|
|
|
&& method.Conversion == MethodConversionKind.FunctionToInstanceMethod |
|
|
|
|
&& Context.ParameterIndex == 0) |
|
|
|
|
{ |
|
|
|
|
Return.Write("NativePtr"); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Return.Write("{0}->NativePtr", Context.Parameter.Name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public bool VisitFieldDecl(Field field) |
|
|
|
|
{ |
|
|
|
|
|