Browse Source

Take advantage of 'this' return information to adjust the return type of structors.

pull/355/head
triton 11 years ago
parent
commit
3b7cf2171d
  1. 3
      src/AST/Type.cs
  2. 9
      src/Generator/Passes/CheckAbiParameters.cs

3
src/AST/Type.cs

@ -214,9 +214,10 @@ namespace CppSharp.AST @@ -214,9 +214,10 @@ namespace CppSharp.AST
/// </summary>
public class PointerType : Type
{
public PointerType()
public PointerType(QualifiedType pointee = new QualifiedType())
{
Modifier = TypeModifier.Pointer;
QualifiedPointee = pointee;
}
/// <summary>

9
src/Generator/Passes/CheckAbiParameters.cs

@ -46,6 +46,15 @@ namespace CppSharp.Passes @@ -46,6 +46,15 @@ namespace CppSharp.Passes
PrimitiveType.Void));
}
if (function.HasThisReturn)
{
// This flag should only be true on methods.
var method = function as Method;
var classType = new QualifiedType(new TagType(method.Namespace),
new TypeQualifiers {IsConst = true});
function.ReturnType = new QualifiedType(new PointerType(classType));
}
// TODO: Handle indirect parameters
return true;

Loading…
Cancel
Save