Browse Source

Added support for CIL types to the type system.

pull/13/merge
triton 12 years ago
parent
commit
3f664784c9
  1. 8
      src/AST/ASTVisitor.cs
  2. 21
      src/AST/Type.cs
  3. 5
      src/Generator/Generators/CLI/CLITypePrinter.cs
  4. 5
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs
  5. 5
      src/Generator/Types/CppTypePrinter.cs

8
src/AST/ASTVisitor.cs

@ -213,6 +213,14 @@ namespace CppSharp @@ -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

21
src/AST/Type.cs

@ -475,6 +475,25 @@ namespace CppSharp @@ -475,6 +475,25 @@ namespace CppSharp
}
}
/// <summary>
/// Represents a CIL type.
/// </summary>
public class CILType : Type
{
public CILType(System.Type type)
{
Type = type;
}
public System.Type Type;
public override T Visit<T>(ITypeVisitor<T> visitor,
TypeQualifiers quals = new TypeQualifiers())
{
return visitor.VisitCILType(this, quals);
}
}
#region Primitives
/// <summary>
@ -548,6 +567,6 @@ namespace CppSharp @@ -548,6 +567,6 @@ namespace CppSharp
TypeQualifiers quals);
T VisitDependentNameType(DependentNameType dependent,
TypeQualifiers quals);
T VisitCILType(CILType type, TypeQualifiers quals);
}
}

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

@ -238,6 +238,11 @@ namespace CppSharp.Generators.CLI @@ -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);

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

@ -289,6 +289,11 @@ namespace CppSharp.Generators.CSharp @@ -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)
{

5
src/Generator/Types/CppTypePrinter.cs

@ -129,6 +129,11 @@ namespace CppSharp.Types @@ -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();

Loading…
Cancel
Save