mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-11-30 02:44:29 +01:00
fb1d9493a3
* Rename enum fields * Naming conventions * Remove unneeded ".this" * Remove unneeded semicolons * Remove unused Usings * Don't use var * Remove unneeded enum underlying types * Explicitly label class visibility * Remove unneeded @ prefixes * Remove unneeded commas * Remove unneeded if expressions * Method doesn't use unsafe code * Remove unneeded casts * Initialized objects don't need an empty constructor * Remove settings from DotSettings * Revert "Explicitly label class visibility" This reverts commit ad5eb5787cc5b27a4631cd46ef5f551c4ae95e51. * Small changes * Revert external enum renaming * Changes from feedback * Apply previous refactorings to the merged code
120 lines
2.6 KiB
C#
120 lines
2.6 KiB
C#
using System.IO;
|
|
|
|
namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
|
{
|
|
public enum Cv
|
|
{
|
|
None,
|
|
Const,
|
|
Volatile,
|
|
Restricted = 4
|
|
}
|
|
|
|
public enum Reference
|
|
{
|
|
None,
|
|
RValue,
|
|
LValue
|
|
}
|
|
|
|
public class CvType : ParentNode
|
|
{
|
|
public Cv Qualifier;
|
|
|
|
public CvType(Cv qualifier, BaseNode child) : base(NodeType.CvQualifierType, child)
|
|
{
|
|
Qualifier = qualifier;
|
|
}
|
|
|
|
public void PrintQualifier(TextWriter writer)
|
|
{
|
|
if ((Qualifier & Cv.Const) != 0)
|
|
{
|
|
writer.Write(" const");
|
|
}
|
|
|
|
if ((Qualifier & Cv.Volatile) != 0)
|
|
{
|
|
writer.Write(" volatile");
|
|
}
|
|
|
|
if ((Qualifier & Cv.Restricted) != 0)
|
|
{
|
|
writer.Write(" restrict");
|
|
}
|
|
}
|
|
|
|
public override void PrintLeft(TextWriter writer)
|
|
{
|
|
if (Child != null)
|
|
{
|
|
Child.PrintLeft(writer);
|
|
}
|
|
|
|
PrintQualifier(writer);
|
|
}
|
|
|
|
public override bool HasRightPart()
|
|
{
|
|
return Child != null && Child.HasRightPart();
|
|
}
|
|
|
|
public override void PrintRight(TextWriter writer)
|
|
{
|
|
if (Child != null)
|
|
{
|
|
Child.PrintRight(writer);
|
|
}
|
|
}
|
|
}
|
|
|
|
public class SimpleReferenceType : ParentNode
|
|
{
|
|
public Reference Qualifier;
|
|
|
|
public SimpleReferenceType(Reference qualifier, BaseNode child) : base(NodeType.SimpleReferenceType, child)
|
|
{
|
|
Qualifier = qualifier;
|
|
}
|
|
|
|
public void PrintQualifier(TextWriter writer)
|
|
{
|
|
if ((Qualifier & Reference.LValue) != 0)
|
|
{
|
|
writer.Write("&");
|
|
}
|
|
|
|
if ((Qualifier & Reference.RValue) != 0)
|
|
{
|
|
writer.Write("&&");
|
|
}
|
|
}
|
|
|
|
public override void PrintLeft(TextWriter writer)
|
|
{
|
|
if (Child != null)
|
|
{
|
|
Child.PrintLeft(writer);
|
|
}
|
|
else if (Qualifier != Reference.None)
|
|
{
|
|
writer.Write(" ");
|
|
}
|
|
|
|
PrintQualifier(writer);
|
|
}
|
|
|
|
public override bool HasRightPart()
|
|
{
|
|
return Child != null && Child.HasRightPart();
|
|
}
|
|
|
|
public override void PrintRight(TextWriter writer)
|
|
{
|
|
if (Child != null)
|
|
{
|
|
Child.PrintRight(writer);
|
|
}
|
|
}
|
|
}
|
|
} |