using System; using System.Collections.Generic; namespace AspClassic.Parser; /// /// A parse tree for a New expression. /// public sealed class NewExpression : Expression { private readonly TypeName _Target; private readonly ArgumentCollection _Arguments; /// /// The target type to create. /// public TypeName Target => _Target; /// /// The arguments to the constructor. /// public ArgumentCollection Arguments => _Arguments; /// /// Constructs a new parse tree for a New expression. /// /// The target type to create. /// The arguments to the constructor. /// The location of the parse tree. 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 childList) { Tree.AddChild(childList, Target); Tree.AddChild(childList, Arguments); } }