aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/BracedRangeExpression.cs
blob: 38d8ccd4dadeb567c7ce1d0d261a68f2445bb23e (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 readonly BaseNode _firstNode;
        private readonly BaseNode _lastNode;
        private readonly 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);
        }
    }
}