using System;
using System.Collections.Generic;
namespace AspClassic.Parser;
///
/// A parse tree for an Exit statement.
///
public sealed class ExitStatement : Statement
{
private readonly BlockType _ExitType;
private readonly Location _ExitArgumentLocation;
///
/// The type of tree this statement exits.
///
public BlockType ExitType => _ExitType;
///
/// The location of the exit statement type.
///
public Location ExitArgumentLocation => _ExitArgumentLocation;
///
/// Constructs a parse tree for an Exit statement.
///
/// The type of tree this statement exits.
/// The location of the exit statement type.
/// The location of the parse tree.
/// The comments for the parse tree.
public ExitStatement(BlockType exitType, Location exitArgumentLocation, Span span, IList comments)
: base(TreeType.ExitStatement, span, comments)
{
switch (exitType)
{
default:
throw new ArgumentOutOfRangeException("exitType");
case BlockType.None:
case BlockType.Do:
case BlockType.For:
case BlockType.While:
case BlockType.Select:
case BlockType.Try:
case BlockType.Sub:
case BlockType.Function:
case BlockType.Property:
_ExitType = exitType;
_ExitArgumentLocation = exitArgumentLocation;
break;
}
}
}