49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// A parse tree for a New expression.
|
|
/// </summary>
|
|
public sealed class NewExpression : Expression
|
|
{
|
|
private readonly TypeName _Target;
|
|
|
|
private readonly ArgumentCollection _Arguments;
|
|
|
|
/// <summary>
|
|
/// The target type to create.
|
|
/// </summary>
|
|
public TypeName Target => _Target;
|
|
|
|
/// <summary>
|
|
/// The arguments to the constructor.
|
|
/// </summary>
|
|
public ArgumentCollection Arguments => _Arguments;
|
|
|
|
/// <summary>
|
|
/// Constructs a new parse tree for a New expression.
|
|
/// </summary>
|
|
/// <param name="target">The target type to create.</param>
|
|
/// <param name="arguments">The arguments to the constructor.</param>
|
|
/// <param name="span">The location of the parse tree.</param>
|
|
public NewExpression(TypeName target, ArgumentCollection arguments, Span span)
|
|
: base(TreeType.NewExpression, span)
|
|
{
|
|
if (target == null)
|
|
{
|
|
throw new ArgumentNullException("target");
|
|
}
|
|
SetParent(target);
|
|
SetParent(arguments);
|
|
_Target = target;
|
|
_Arguments = arguments;
|
|
}
|
|
|
|
protected override void GetChildTrees(IList<Tree> childList)
|
|
{
|
|
Tree.AddChild(childList, Target);
|
|
Tree.AddChild(childList, Arguments);
|
|
}
|
|
}
|