53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
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);
|
|
}
|
|
}
|