mirror of https://github.com/mono/CppSharp.git
9 changed files with 65 additions and 11 deletions
@ -0,0 +1,29 @@ |
|||||||
|
using CppSharp.AST; |
||||||
|
|
||||||
|
namespace CppSharp.Passes |
||||||
|
{ |
||||||
|
public class ParamTypeToInterfacePass : TranslationUnitPass |
||||||
|
{ |
||||||
|
public override bool VisitParameterDecl(Parameter parameter) |
||||||
|
{ |
||||||
|
var tagType = parameter.QualifiedType.Type as TagType; |
||||||
|
if (tagType == null) |
||||||
|
{ |
||||||
|
var pointerType = parameter.QualifiedType.Type as PointerType; |
||||||
|
if (pointerType != null) |
||||||
|
tagType = pointerType.Pointee as TagType; |
||||||
|
} |
||||||
|
if (tagType != null) |
||||||
|
{ |
||||||
|
var @class = tagType.Declaration as Class; |
||||||
|
if (@class != null) |
||||||
|
{ |
||||||
|
var @interface = @class.Namespace.FindClass("I" + @class.Name); |
||||||
|
if (@interface != null) |
||||||
|
parameter.QualifiedType = new QualifiedType(new TagType(@interface)); |
||||||
|
} |
||||||
|
} |
||||||
|
return base.VisitParameterDecl(parameter); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue