Browse Source

Improved debugging representation of template arguments and specializations.

pull/685/head
Joao Matos 9 years ago
parent
commit
1206b48776
  1. 6
      src/AST/Template.cs
  2. 25
      src/AST/Type.cs

6
src/AST/Template.cs

@ -306,6 +306,12 @@ namespace CppSharp.AST @@ -306,6 +306,12 @@ namespace CppSharp.AST
{
return visitor.VisitClassTemplateSpecializationDecl(this);
}
public override string ToString()
{
var args = string.Join(", ", Arguments.Select(a => a.ToString()));
return string.Format("{0}<{1}> [{2}]", OriginalName, args, SpecializationKind);
}
}
/// <summary>

25
src/AST/Type.cs

@ -26,6 +26,12 @@ namespace CppSharp.AST @@ -26,6 +26,12 @@ namespace CppSharp.AST
public abstract T Visit<T>(ITypeVisitor<T> visitor, TypeQualifiers quals
= new TypeQualifiers());
public string ToNativeString()
{
var cppTypePrinter = new CppTypePrinter { PrintScopeKind = CppTypePrintScopeKind.Qualified };
return Visit(cppTypePrinter);
}
public override string ToString()
{
return TypePrinterDelegate(this);
@ -591,7 +597,7 @@ namespace CppSharp.AST @@ -591,7 +597,7 @@ namespace CppSharp.AST
case ArgumentKind.Expression:
return true;
default:
throw new Exception("Unknowed TemplateArgument Kind");
throw new Exception("Unknown TemplateArgument Kind");
}
}
@ -599,6 +605,23 @@ namespace CppSharp.AST @@ -599,6 +605,23 @@ namespace CppSharp.AST
{
return base.GetHashCode();
}
public override string ToString()
{
switch (Kind)
{
case ArgumentKind.Type:
return Type.ToString();
case ArgumentKind.Declaration:
return Declaration.ToString();
case ArgumentKind.Integral:
return Integral.ToString();
case ArgumentKind.Expression:
return string.Empty;
default:
throw new Exception("Unknown TemplateArgument Kind");
}
}
}
/// <summary>

Loading…
Cancel
Save