2018-09-15 06:29:18 -07:00
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
public enum Cv
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
|
|
|
None,
|
|
|
|
Const,
|
|
|
|
Volatile,
|
|
|
|
Restricted = 4
|
|
|
|
}
|
|
|
|
|
|
|
|
public enum Reference
|
|
|
|
{
|
|
|
|
None,
|
|
|
|
RValue,
|
|
|
|
LValue
|
|
|
|
}
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
public class CvType : ParentNode
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
public Cv Qualifier;
|
2018-09-15 06:29:18 -07:00
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
public CvType(Cv qualifier, BaseNode child) : base(NodeType.CvQualifierType, child)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
Qualifier = qualifier;
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
public void PrintQualifier(TextWriter writer)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
if ((Qualifier & Cv.Const) != 0)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
writer.Write(" const");
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
if ((Qualifier & Cv.Volatile) != 0)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
writer.Write(" volatile");
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
if ((Qualifier & Cv.Restricted) != 0)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
writer.Write(" restrict");
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
public override void PrintLeft(TextWriter writer)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
|
|
|
if (Child != null)
|
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
Child.PrintLeft(writer);
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
PrintQualifier(writer);
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public override bool HasRightPart()
|
|
|
|
{
|
|
|
|
return Child != null && Child.HasRightPart();
|
|
|
|
}
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
public override void PrintRight(TextWriter writer)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
|
|
|
if (Child != null)
|
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
Child.PrintRight(writer);
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class SimpleReferenceType : ParentNode
|
|
|
|
{
|
|
|
|
public Reference Qualifier;
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
public SimpleReferenceType(Reference qualifier, BaseNode child) : base(NodeType.SimpleReferenceType, child)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
Qualifier = qualifier;
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
public void PrintQualifier(TextWriter writer)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
|
|
|
if ((Qualifier & Reference.LValue) != 0)
|
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
writer.Write("&");
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((Qualifier & Reference.RValue) != 0)
|
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
writer.Write("&&");
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
public override void PrintLeft(TextWriter writer)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
|
|
|
if (Child != null)
|
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
Child.PrintLeft(writer);
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
else if (Qualifier != Reference.None)
|
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
writer.Write(" ");
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
PrintQualifier(writer);
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public override bool HasRightPart()
|
|
|
|
{
|
|
|
|
return Child != null && Child.HasRightPart();
|
|
|
|
}
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
public override void PrintRight(TextWriter writer)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
|
|
|
if (Child != null)
|
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
Child.PrintRight(writer);
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|