48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// A parse tree for an Else If statement.
|
|
/// </summary>
|
|
public sealed class ElseIfStatement : Statement
|
|
{
|
|
private readonly Expression _Expression;
|
|
|
|
private readonly Location _ThenLocation;
|
|
|
|
/// <summary>
|
|
/// The conditional expression.
|
|
/// </summary>
|
|
public Expression Expression => _Expression;
|
|
|
|
/// <summary>
|
|
/// The location of the 'Then', if any.
|
|
/// </summary>
|
|
public Location ThenLocation => _ThenLocation;
|
|
|
|
/// <summary>
|
|
/// Constructs a new parse tree for an Else If statement.
|
|
/// </summary>
|
|
/// <param name="expression">The conditional expression.</param>
|
|
/// <param name="thenLocation">The location of the 'Then', if any.</param>
|
|
/// <param name="span">The location of the parse tree.</param>
|
|
/// <param name="comments">The comments for the parse tree.</param>
|
|
public ElseIfStatement(Expression expression, Location thenLocation, Span span, IList<Comment> comments)
|
|
: base(TreeType.ElseIfStatement, span, comments)
|
|
{
|
|
if (expression == null)
|
|
{
|
|
throw new ArgumentNullException("expression");
|
|
}
|
|
SetParent(expression);
|
|
_Expression = expression;
|
|
_ThenLocation = thenLocation;
|
|
}
|
|
|
|
protected override void GetChildTrees(IList<Tree> childList)
|
|
{
|
|
Tree.AddChild(childList, Expression);
|
|
}
|
|
}
|