Browse Source

Merge pull request #278 from ddobrev/master

Simplified the getting of a function type now that the more complex (native) type is no longer used for abstract impls
pull/279/head
João Matos 12 years ago
parent
commit
5151bcbe70
  1. 9
      src/AST/Function.cs
  2. 18
      src/AST/Method.cs

9
src/AST/Function.cs

@ -211,7 +211,7 @@ namespace CppSharp.AST
public Type Type { get { return ReturnType.Type; } } public Type Type { get { return ReturnType.Type; } }
public QualifiedType QualifiedType { get { return ReturnType; } } public QualifiedType QualifiedType { get { return ReturnType; } }
public virtual QualifiedType GetFunctionType() public FunctionType GetFunctionType()
{ {
var functionType = new FunctionType var functionType = new FunctionType
{ {
@ -222,12 +222,7 @@ namespace CppSharp.AST
functionType.Parameters.AddRange(Parameters); functionType.Parameters.AddRange(Parameters);
ReplaceIndirectReturnParamWithRegular(functionType); ReplaceIndirectReturnParamWithRegular(functionType);
var pointerType = new PointerType return functionType;
{
QualifiedPointee = new QualifiedType(functionType)
};
return new QualifiedType(pointerType);
} }
static void ReplaceIndirectReturnParamWithRegular(FunctionType functionType) static void ReplaceIndirectReturnParamWithRegular(FunctionType functionType)

18
src/AST/Method.cs

@ -151,23 +151,5 @@ namespace CppSharp.AST
{ {
return visitor.VisitMethodDecl(this); return visitor.VisitMethodDecl(this);
} }
public override QualifiedType GetFunctionType()
{
var qualifiedType = base.GetFunctionType();
if (!IsStatic)
{
FunctionType functionType;
qualifiedType.Type.IsPointerTo(out functionType);
var instance = new Parameter
{
Name = "instance",
QualifiedType = new QualifiedType(
new BuiltinType(PrimitiveType.IntPtr))
};
functionType.Parameters.Insert(0, instance);
}
return qualifiedType;
}
} }
} }
Loading…
Cancel
Save