Ryujinx/Ryujinx.HLE/HOS/Diagnostics/Demangler/Ast/NewExpression.cs

55 lines
1.5 KiB
C#
Raw Normal View History

using System.IO;
namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
{
public class NewExpression : BaseNode
{
2018-12-01 20:01:59 +00:00
private NodeArray _expressions;
private BaseNode _typeNode;
private NodeArray _initializers;
2018-12-01 20:01:59 +00:00
private bool _isGlobal;
private bool _isArrayExpression;
2018-12-01 20:01:59 +00:00
public NewExpression(NodeArray expressions, BaseNode typeNode, NodeArray initializers, bool isGlobal, bool isArrayExpression) : base(NodeType.NewExpression)
{
2018-12-01 20:01:59 +00:00
this._expressions = expressions;
this._typeNode = typeNode;
this._initializers = initializers;
2018-12-01 20:01:59 +00:00
this._isGlobal = isGlobal;
this._isArrayExpression = isArrayExpression;
}
2018-12-01 20:01:59 +00:00
public override void PrintLeft(TextWriter writer)
{
2018-12-01 20:01:59 +00:00
if (_isGlobal)
{
2018-12-01 20:01:59 +00:00
writer.Write("::operator ");
}
2018-12-01 20:01:59 +00:00
writer.Write("new ");
2018-12-01 20:01:59 +00:00
if (_isArrayExpression)
{
2018-12-01 20:01:59 +00:00
writer.Write("[] ");
}
2018-12-01 20:01:59 +00:00
if (_expressions.Nodes.Count != 0)
{
2018-12-01 20:01:59 +00:00
writer.Write("(");
_expressions.Print(writer);
writer.Write(")");
}
2018-12-01 20:01:59 +00:00
_typeNode.Print(writer);
2018-12-01 20:01:59 +00:00
if (_initializers.Nodes.Count != 0)
{
2018-12-01 20:01:59 +00:00
writer.Write("(");
_initializers.Print(writer);
writer.Write(")");
}
}
}
}