using System; using System.Collections.Generic; namespace AspClassic.Parser; /// /// A parse tree for a ReDim statement. /// public sealed class ReDimStatement : Statement { private readonly Location _PreserveLocation; private readonly ExpressionCollection _Variables; /// /// The location of the 'Preserve', if any. /// public Location PreserveLocation => _PreserveLocation; /// /// The variables to redimension (includes bounds). /// public ExpressionCollection Variables => _Variables; /// /// Whether the statement included a Preserve keyword. /// public bool IsPreserve => PreserveLocation.IsValid; /// /// Constructs a new parse tree for a ReDim statement. /// /// The location of the 'Preserve', if any. /// The variables to redimension (includes bounds). /// The location of the parse tree. /// The comments for the parse tree. public ReDimStatement(Location preserveLocation, ExpressionCollection variables, Span span, IList comments) : base(TreeType.ReDimStatement, span, comments) { if (variables == null) { throw new ArgumentNullException("variables"); } SetParent(variables); _PreserveLocation = preserveLocation; _Variables = variables; } protected override void GetChildTrees(IList childList) { Tree.AddChild(childList, Variables); } }