2018-09-15 13:29:18 +00:00
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
|
|
|
{
|
|
|
|
public class FoldExpression : BaseNode
|
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
private bool IsLeftFold;
|
|
|
|
private string OperatorName;
|
|
|
|
private BaseNode Expression;
|
|
|
|
private BaseNode Initializer;
|
2018-09-15 13:29:18 +00:00
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
public FoldExpression(bool IsLeftFold, string OperatorName, BaseNode Expression, BaseNode Initializer) : base(NodeType.FunctionParameter)
|
2018-09-15 13:29:18 +00:00
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
this.IsLeftFold = IsLeftFold;
|
|
|
|
this.OperatorName = OperatorName;
|
|
|
|
this.Expression = Expression;
|
|
|
|
this.Initializer = Initializer;
|
2018-09-15 13:29:18 +00:00
|
|
|
}
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
public override void PrintLeft(TextWriter Writer)
|
2018-09-15 13:29:18 +00:00
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
Writer.Write("(");
|
2018-09-15 13:29:18 +00:00
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
if (IsLeftFold && Initializer != null)
|
2018-09-15 13:29:18 +00:00
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
Initializer.Print(Writer);
|
|
|
|
Writer.Write(" ");
|
|
|
|
Writer.Write(OperatorName);
|
|
|
|
Writer.Write(" ");
|
2018-09-15 13:29:18 +00:00
|
|
|
}
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
Writer.Write(IsLeftFold ? "... " : " ");
|
|
|
|
Writer.Write(OperatorName);
|
|
|
|
Writer.Write(!IsLeftFold ? " ..." : " ");
|
|
|
|
Expression.Print(Writer);
|
2018-09-15 13:29:18 +00:00
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
if (!IsLeftFold && Initializer != null)
|
2018-09-15 13:29:18 +00:00
|
|
|
{
|
2018-12-05 00:52:39 +00:00
|
|
|
Initializer.Print(Writer);
|
|
|
|
Writer.Write(" ");
|
|
|
|
Writer.Write(OperatorName);
|
|
|
|
Writer.Write(" ");
|
2018-09-15 13:29:18 +00:00
|
|
|
}
|
|
|
|
|
2018-12-05 00:52:39 +00:00
|
|
|
Writer.Write(")");
|
2018-09-15 13:29:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|