This commit is contained in:
Jelle Luteijn 2022-05-15 11:19:49 +02:00
parent 16e76d6b31
commit 484dbfc9d9
529 changed files with 113694 additions and 0 deletions

View file

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