aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/NewExpression.cs
blob: 5cc14ad9f8a52004364b3aa0a6f4aeff46d1ba6b (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System.IO;

namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
{
    public class NewExpression : BaseNode
    {
        private NodeArray Expressions;
        private BaseNode  TypeNode;
        private NodeArray Initializers;

        private bool IsGlobal;
        private bool IsArrayExpression;

        public NewExpression(NodeArray Expressions, BaseNode TypeNode, NodeArray Initializers, bool IsGlobal, bool IsArrayExpression) : base(NodeType.NewExpression)
        {
            this.Expressions       = Expressions;
            this.TypeNode          = TypeNode;
            this.Initializers      = Initializers;

            this.IsGlobal          = IsGlobal;
            this.IsArrayExpression = IsArrayExpression;
        }

        public override void PrintLeft(TextWriter Writer)
        {
            if (IsGlobal)
            {
                Writer.Write("::operator ");
            }

            Writer.Write("new ");

            if (IsArrayExpression)
            {
                Writer.Write("[] ");
            }

            if (Expressions.Nodes.Count != 0)
            {
                Writer.Write("(");
                Expressions.Print(Writer);
                Writer.Write(")");
            }

            TypeNode.Print(Writer);

            if (Initializers.Nodes.Count != 0)
            {
                Writer.Write("(");
                Initializers.Print(Writer);
                Writer.Write(")");
            }
        }
    }
}