using System.Collections.Generic;
namespace AspClassic.Parser;
///
/// A parse tree for a Loop statement.
///
public sealed class LoopStatement : Statement
{
private readonly bool _IsWhile;
private readonly Location _WhileOrUntilLocation;
private readonly Expression _Expression;
///
/// Whether the Loop has a While or Until.
///
public bool IsWhile => _IsWhile;
///
/// The location of the While or Until, if any.
///
public Location WhileOrUntilLocation => _WhileOrUntilLocation;
///
/// The loop expression, if any.
///
public Expression Expression => _Expression;
///
/// Constructs a parse tree for a Loop statement.
///
/// The loop expression, if any.
/// WHether the Loop has a While or Until.
/// The location of the While or Until, if any.
/// The location of the parse tree.
/// The comments for the parse tree.
public LoopStatement(Expression expression, bool isWhile, Location whileOrUntilLocation, Span span, IList comments)
: base(TreeType.LoopStatement, span, comments)
{
SetParent(expression);
_Expression = expression;
_IsWhile = isWhile;
_WhileOrUntilLocation = whileOrUntilLocation;
}
protected override void GetChildTrees(IList childList)
{
Tree.AddChild(childList, Expression);
}
}