aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/EncodedFunction.cs
blob: 37a9a7afe0aaf0eef4c6c04e78fba64ff2585978 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System.IO;

namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
{
    public class EncodedFunction : BaseNode
    {
        private BaseNode Name;
        private BaseNode Params;
        private BaseNode CV;
        private BaseNode Ref;
        private BaseNode Attrs;
        private BaseNode Ret;

        public EncodedFunction(BaseNode Name, BaseNode Params, BaseNode CV, BaseNode Ref, BaseNode Attrs, BaseNode Ret) : base(NodeType.NameType)
        {
            this.Name   = Name;
            this.Params = Params;
            this.CV     = CV;
            this.Ref    = Ref;
            this.Attrs  = Attrs;
            this.Ret    = Ret;
        }

        public override void PrintLeft(TextWriter Writer)
        {
            if (Ret != null)
            {
                Ret.PrintLeft(Writer);

                if (!Ret.HasRightPart())
                {
                    Writer.Write(" ");
                }
            }

            Name.Print(Writer);

        }

        public override bool HasRightPart()
        {
            return true;
        }

        public override void PrintRight(TextWriter Writer)
        {
            Writer.Write("(");

            if (Params != null)
            {
                Params.Print(Writer);
            }

            Writer.Write(")");

            if (Ret != null)
            {
                Ret.PrintRight(Writer);
            }

            if (CV != null)
            {
                CV.Print(Writer);
            }

            if (Ref != null)
            {
                Ref.Print(Writer);
            }

            if (Attrs != null)
            {
                Attrs.Print(Writer);
            }
        }
    }
}