2018-09-15 06:29:18 -07:00
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Diagnostics.Demangler.Ast
|
|
|
|
{
|
|
|
|
public class NewExpression : BaseNode
|
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
private NodeArray _expressions;
|
|
|
|
private BaseNode _typeNode;
|
|
|
|
private NodeArray _initializers;
|
2018-09-15 06:29:18 -07:00
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
private bool _isGlobal;
|
|
|
|
private bool _isArrayExpression;
|
2018-09-15 06:29:18 -07:00
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
public NewExpression(NodeArray expressions, BaseNode typeNode, NodeArray initializers, bool isGlobal, bool isArrayExpression) : base(NodeType.NewExpression)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
_expressions = expressions;
|
|
|
|
_typeNode = typeNode;
|
|
|
|
_initializers = initializers;
|
2018-09-15 06:29:18 -07:00
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
_isGlobal = isGlobal;
|
|
|
|
_isArrayExpression = isArrayExpression;
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
public override void PrintLeft(TextWriter writer)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
if (_isGlobal)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
writer.Write("::operator ");
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
writer.Write("new ");
|
2018-09-15 06:29:18 -07:00
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
if (_isArrayExpression)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
writer.Write("[] ");
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
if (_expressions.Nodes.Count != 0)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
writer.Write("(");
|
|
|
|
_expressions.Print(writer);
|
|
|
|
writer.Write(")");
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
_typeNode.Print(writer);
|
2018-09-15 06:29:18 -07:00
|
|
|
|
2018-12-04 12:23:37 -08:00
|
|
|
if (_initializers.Nodes.Count != 0)
|
2018-09-15 06:29:18 -07:00
|
|
|
{
|
2018-12-04 12:23:37 -08:00
|
|
|
writer.Write("(");
|
|
|
|
_initializers.Print(writer);
|
|
|
|
writer.Write(")");
|
2018-09-15 06:29:18 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|