Browse Source

Added an unsupported type node to the AST.

pull/696/head
Joao Matos 9 years ago
parent
commit
76ce6c7836
  1. 11
      src/AST/ASTVisitor.cs
  2. 7
      src/AST/CppTypePrinter.cs
  3. 25
      src/AST/Type.cs
  4. 5
      src/Generator/Generators/CLI/CLITypePrinter.cs
  5. 5
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs
  6. 5
      src/Generator/Passes/CheckVirtualOverrideReturnCovariance.cs

11
src/AST/ASTVisitor.cs

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
namespace CppSharp.AST namespace CppSharp.AST
{ {
@ -278,6 +279,14 @@ namespace CppSharp.AST
return true; return true;
} }
public bool VisitUnsupportedType(UnsupportedType type, TypeQualifiers quals)
{
if (!VisitType(type, quals))
return false;
return true;
}
#endregion #endregion
#region Decl Visitors #region Decl Visitors

7
src/AST/CppTypePrinter.cs

@ -227,7 +227,12 @@ namespace CppSharp.AST
return quals.IsConst ? "const char*" : "char*"; return quals.IsConst ? "const char*" : "char*";
throw new NotImplementedException(string.Format("Unhandled .NET type: {0}", type.Type)); throw new NotImplementedException(string.Format("Unhandled .NET type: {0}", type.Type));
} }
public string VisitUnsupportedType(UnsupportedType type, TypeQualifiers quals)
{
return string.Empty;
}
public string VisitPrimitiveType(PrimitiveType type, TypeQualifiers quals) public string VisitPrimitiveType(PrimitiveType type, TypeQualifiers quals)
{ {

25
src/AST/Type.cs

@ -1054,6 +1054,30 @@ namespace CppSharp.AST
} }
} }
public class UnsupportedType : Type
{
public UnsupportedType()
{
}
public UnsupportedType(UnsupportedType type)
: base(type)
{
}
public string Description;
public override T Visit<T>(ITypeVisitor<T> visitor, TypeQualifiers quals = new TypeQualifiers())
{
return visitor.VisitUnsupportedType(this, quals);
}
public override object Clone()
{
return new UnsupportedType(this);
}
}
#region Primitives #region Primitives
/// <summary> /// <summary>
@ -1185,5 +1209,6 @@ namespace CppSharp.AST
T VisitUnaryTransformType(UnaryTransformType unaryTransformType, TypeQualifiers quals); T VisitUnaryTransformType(UnaryTransformType unaryTransformType, TypeQualifiers quals);
T VisitVectorType(VectorType vectorType, TypeQualifiers quals); T VisitVectorType(VectorType vectorType, TypeQualifiers quals);
T VisitCILType(CILType type, TypeQualifiers quals); T VisitCILType(CILType type, TypeQualifiers quals);
T VisitUnsupportedType(UnsupportedType type, TypeQualifiers quals);
} }
} }

5
src/Generator/Generators/CLI/CLITypePrinter.cs

@ -340,6 +340,11 @@ namespace CppSharp.Generators.CLI
return VisitPrimitiveType(type); return VisitPrimitiveType(type);
} }
public string VisitUnsupportedType(UnsupportedType type, TypeQualifiers quals)
{
throw new NotImplementedException();
}
public string VisitDeclaration(Declaration decl, TypeQualifiers quals) public string VisitDeclaration(Declaration decl, TypeQualifiers quals)
{ {
return VisitDeclaration(decl); return VisitDeclaration(decl);

5
src/Generator/Generators/CSharp/CSharpTypePrinter.cs

@ -842,6 +842,11 @@ namespace CppSharp.Generators.CSharp
throw new NotImplementedException(); throw new NotImplementedException();
} }
public CSharpTypePrinterResult VisitUnsupportedType(UnsupportedType type, TypeQualifiers quals)
{
throw new NotImplementedException();
}
public CSharpTypePrinterResult VisitFunctionTemplateSpecializationDecl(FunctionTemplateSpecialization specialization) public CSharpTypePrinterResult VisitFunctionTemplateSpecializationDecl(FunctionTemplateSpecialization specialization)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

5
src/Generator/Passes/CheckVirtualOverrideReturnCovariance.cs

@ -186,6 +186,11 @@ namespace CppSharp.Passes
return false; return false;
} }
public bool VisitUnsupportedType(UnsupportedType type, TypeQualifiers quals)
{
return false;
}
public bool VisitDeclaration(Declaration decl) public bool VisitDeclaration(Declaration decl)
{ {
return false; return false;

Loading…
Cancel
Save