53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// A parse tree for a New array expression.
|
|
/// </summary>
|
|
public sealed class NewAggregateExpression : Expression
|
|
{
|
|
private readonly ArrayTypeName _Target;
|
|
|
|
private readonly AggregateInitializer _Initializer;
|
|
|
|
/// <summary>
|
|
/// The target array type to create.
|
|
/// </summary>
|
|
public ArrayTypeName Target => _Target;
|
|
|
|
/// <summary>
|
|
/// The initializer for the array.
|
|
/// </summary>
|
|
public AggregateInitializer Initializer => _Initializer;
|
|
|
|
/// <summary>
|
|
/// The constructor for a New array expression parse tree.
|
|
/// </summary>
|
|
/// <param name="target">The target array type to create.</param>
|
|
/// <param name="initializer">The initializer for the array.</param>
|
|
/// <param name="span">The location of the parse tree.</param>
|
|
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<Tree> childList)
|
|
{
|
|
Tree.AddChild(childList, Target);
|
|
Tree.AddChild(childList, Initializer);
|
|
}
|
|
}
|