aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/BracedRangeExpression.cs
blob: 802422d9a126766c336b5edb58ec2832edb02149 (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
using System.IO;

namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
{
    public class BracedRangeExpression : BaseNode
    {
        private BaseNode _firstNode;
        private BaseNode _lastNode;
        private BaseNode _expression;

        public BracedRangeExpression(BaseNode firstNode, BaseNode lastNode, BaseNode expression) : base(NodeType.BracedRangeExpression)
        {
            _firstNode  = firstNode;
            _lastNode   = lastNode;
            _expression = expression;
        }

        public override void PrintLeft(TextWriter writer)
        {
            writer.Write("[");
            _firstNode.Print(writer);
            writer.Write(" ... ");
            _lastNode.Print(writer);
            writer.Write("]");

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

            _expression.Print(writer);
        }
    }
}