diff --git a/src/AST/ASTVisitor.cs b/src/AST/ASTVisitor.cs index 7dfc976e..616f6570 100644 --- a/src/AST/ASTVisitor.cs +++ b/src/AST/ASTVisitor.cs @@ -213,6 +213,14 @@ namespace CppSharp return true; } + public virtual bool VisitCILType(CILType type, TypeQualifiers quals) + { + if (!VisitType(type, quals)) + return false; + + return true; + } + #endregion #region Decl Visitors diff --git a/src/AST/Type.cs b/src/AST/Type.cs index f0977d33..60b3402d 100644 --- a/src/AST/Type.cs +++ b/src/AST/Type.cs @@ -475,6 +475,25 @@ namespace CppSharp } } + /// + /// Represents a CIL type. + /// + public class CILType : Type + { + public CILType(System.Type type) + { + Type = type; + } + + public System.Type Type; + + public override T Visit(ITypeVisitor visitor, + TypeQualifiers quals = new TypeQualifiers()) + { + return visitor.VisitCILType(this, quals); + } + } + #region Primitives /// @@ -548,6 +567,6 @@ namespace CppSharp TypeQualifiers quals); T VisitDependentNameType(DependentNameType dependent, TypeQualifiers quals); - + T VisitCILType(CILType type, TypeQualifiers quals); } } \ No newline at end of file diff --git a/src/Generator/Generators/CLI/CLITypePrinter.cs b/src/Generator/Generators/CLI/CLITypePrinter.cs index 174b8564..ec115f5c 100644 --- a/src/Generator/Generators/CLI/CLITypePrinter.cs +++ b/src/Generator/Generators/CLI/CLITypePrinter.cs @@ -238,6 +238,11 @@ namespace CppSharp.Generators.CLI throw new NotImplementedException(); } + public string VisitCILType(CILType type, TypeQualifiers quals) + { + return type.Type.FullName.Replace(".", "::") + "^"; + } + public string VisitPrimitiveType(PrimitiveType type, TypeQualifiers quals) { return VisitPrimitiveType(type); diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index abd1b247..a1d902ac 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -289,6 +289,11 @@ namespace CppSharp.Generators.CSharp throw new NotImplementedException(); } + public CSharpTypePrinterResult VisitCILType(CILType type, TypeQualifiers quals) + { + return type.Type.FullName; + } + public CSharpTypePrinterResult VisitPrimitiveType(PrimitiveType primitive, TypeQualifiers quals) { diff --git a/src/Generator/Types/CppTypePrinter.cs b/src/Generator/Types/CppTypePrinter.cs index 17fc4695..52af9f41 100644 --- a/src/Generator/Types/CppTypePrinter.cs +++ b/src/Generator/Types/CppTypePrinter.cs @@ -129,6 +129,11 @@ namespace CppSharp.Types throw new System.NotImplementedException(); } + public string VisitCILType(CILType type, TypeQualifiers quals) + { + throw new NotImplementedException(); + } + public string VisitPrimitiveType(PrimitiveType type, TypeQualifiers quals) { throw new System.NotImplementedException();