aspclassic-core/AspClassic.Parser/EndBlockStatement.cs
Jelle Luteijn 484dbfc9d9 progress
2022-05-15 11:19:49 +02:00

42 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
namespace AspClassic.Parser;
/// <summary>
/// A parse tree for an End statement of a block.
/// </summary>
public sealed class EndBlockStatement : Statement
{
private readonly BlockType _EndType;
private readonly Location _EndArgumentLocation;
/// <summary>
/// The type of block the statement ends.
/// </summary>
public BlockType EndType => _EndType;
/// <summary>
/// The location of the end block argument.
/// </summary>
public Location EndArgumentLocation => _EndArgumentLocation;
/// <summary>
/// Creates a new parse tree for an End block statement.
/// </summary>
/// <param name="endType">The type of the block the statement ends.</param>
/// <param name="endArgumentLocation">The location of the end block argument.</param>
/// <param name="span">The location of the parse tree.</param>
/// <param name="comments">The comments for the parse tree.</param>
public EndBlockStatement(BlockType endType, Location endArgumentLocation, Span span, IList<Comment> comments)
: base(TreeType.EndBlockStatement, span, comments)
{
if (endType < BlockType.While || endType > BlockType.Namespace)
{
throw new ArgumentOutOfRangeException("endType");
}
_EndType = endType;
_EndArgumentLocation = endArgumentLocation;
}
}