0
0
Fork 0
mirror of https://github.com/GreemDev/Ryujinx.git synced 2024-12-27 01:55:49 +00:00
Ryujinx/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/Qualifier.cs
Alex Barney fb1d9493a3 Adjust naming conventions and general refactoring in HLE Project (#527)
* 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
2018-12-06 09:16:24 -02:00

120 lines
No EOL
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);
}
}
}
}