using System; using System.Collections.Generic; namespace AspClassic.Parser; /// /// A parse tree for an argument to a call or index. /// public sealed class Argument : Tree { private readonly SimpleName _Name; private readonly Location _ColonEqualsLocation; private readonly Expression _Expression; /// /// The name of the argument, if any. /// public SimpleName Name => _Name; /// /// The location of the ':=', if any. /// public Location ColonEqualsLocation => _ColonEqualsLocation; /// /// The argument, if any. /// public Expression Expression => _Expression; /// /// Constructs a new parse tree for an argument. /// /// The name of the argument, if any. /// The location of the ':=', if any. /// The expression, if any. /// The location of the parse tree. public Argument(SimpleName name, Location colonEqualsLocation, Expression expression, Span span) : base(TreeType.Argument, span) { if (expression == null) { throw new ArgumentNullException("expression"); } SetParent(name); SetParent(expression); _Name = name; _ColonEqualsLocation = colonEqualsLocation; _Expression = expression; } private Argument() : base(TreeType.Argument, default(Span)) { } protected override void GetChildTrees(IList childList) { Tree.AddChild(childList, Name); Tree.AddChild(childList, Expression); } }