using System;
using System.Collections.Generic;
namespace AspClassic.Parser;
///
/// A parse tree for a New array expression.
///
public sealed class NewAggregateExpression : Expression
{
private readonly ArrayTypeName _Target;
private readonly AggregateInitializer _Initializer;
///
/// The target array type to create.
///
public ArrayTypeName Target => _Target;
///
/// The initializer for the array.
///
public AggregateInitializer Initializer => _Initializer;
///
/// The constructor for a New array expression parse tree.
///
/// The target array type to create.
/// The initializer for the array.
/// The location of the parse tree.
public NewAggregateExpression(ArrayTypeName target, AggregateInitializer initializer, Span span)
: base(TreeType.NewAggregateExpression, span)
{
if (target == null)
{
throw new ArgumentNullException("target");
}
if (initializer == null)
{
throw new ArgumentNullException("initializer");
}
SetParent(target);
SetParent(initializer);
_Target = target;
_Initializer = initializer;
}
protected override void GetChildTrees(IList childList)
{
Tree.AddChild(childList, Target);
Tree.AddChild(childList, Initializer);
}
}