aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/IntegerLiteral.cs
blob: 215cf6dce5d3c9847d8399bfa8f0a6b703cb6e34 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System.IO;

namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
{
    public class IntegerLiteral : BaseNode
    {
        private string LitteralName;
        private string LitteralValue;

        public IntegerLiteral(string LitteralName, string LitteralValue) : base(NodeType.IntegerLiteral)
        {
            this.LitteralValue = LitteralValue;
            this.LitteralName  = LitteralName;
        }

        public override void PrintLeft(TextWriter Writer)
        {
            if (LitteralName.Length > 3)
            {
                Writer.Write("(");
                Writer.Write(LitteralName);
                Writer.Write(")");
            }

            if (LitteralValue[0] == 'n')
            {
                Writer.Write("-");
                Writer.Write(LitteralValue.Substring(1));
            }
            else
            {
                Writer.Write(LitteralValue);
            }

            if (LitteralName.Length <= 3)
            {
                Writer.Write(LitteralName);
            }
        }
    }
}