aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/BracedExpression.cs
blob: 59222ea3f984c6ad7db737df40340a4ee65d0377 (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
using System.IO;

namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
{
    public class BracedExpression : BaseNode
    {
        private BaseNode Element;
        private BaseNode Expression;
        private bool     IsArrayExpression;

        public BracedExpression(BaseNode Element, BaseNode Expression, bool IsArrayExpression) : base(NodeType.BracedExpression)
        {
            this.Element           = Element;
            this.Expression        = Expression;
            this.IsArrayExpression = IsArrayExpression;
        }

        public override void PrintLeft(TextWriter Writer)
        {
            if (IsArrayExpression)
            {
                Writer.Write("[");
                Element.Print(Writer);
                Writer.Write("]");
            }
            else
            {
                Writer.Write(".");
                Element.Print(Writer);
            }

            if (!Expression.GetType().Equals(NodeType.BracedExpression) || !Expression.GetType().Equals(NodeType.BracedRangeExpression))
            {
                Writer.Write(" = ");
            }

            Expression.Print(Writer);
        }
    }
}