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

41 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
namespace AspClassic.Parser;
/// <summary>
/// A parse tree for an Else block statement.
/// </summary>
public sealed class ElseBlockStatement : BlockStatement
{
private readonly ElseStatement _ElseStatement;
/// <summary>
/// The Else or Else If statement.
/// </summary>
public ElseStatement ElseStatement => _ElseStatement;
/// <summary>
/// Constructs a new parse tree for an Else block statement.
/// </summary>
/// <param name="elseStatement">The Else statement.</param>
/// <param name="statements">The statements in the block.</param>
/// <param name="span">The location of the parse tree.</param>
/// <param name="comments">The comments for the parse tree.</param>
public ElseBlockStatement(ElseStatement elseStatement, StatementCollection statements, Span span, IList<Comment> comments)
: base(TreeType.ElseBlockStatement, statements, span, comments)
{
if (elseStatement == null)
{
throw new ArgumentNullException("elseStatement");
}
SetParent(elseStatement);
_ElseStatement = elseStatement;
}
protected override void GetChildTrees(IList<Tree> childList)
{
Tree.AddChild(childList, ElseStatement);
base.GetChildTrees(childList);
}
}