74 lines
2.2 KiB
C#
74 lines
2.2 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// A parse tree for a Catch statement.
|
|
/// </summary>
|
|
public sealed class CatchStatement : Statement
|
|
{
|
|
private readonly SimpleName _Name;
|
|
|
|
private readonly Location _AsLocation;
|
|
|
|
private readonly TypeName _ExceptionType;
|
|
|
|
private readonly Location _WhenLocation;
|
|
|
|
private readonly Expression _FilterExpression;
|
|
|
|
/// <summary>
|
|
/// The name of the catch variable, if any.
|
|
/// </summary>
|
|
public SimpleName Name => _Name;
|
|
|
|
/// <summary>
|
|
/// The location of the 'As', if any.
|
|
/// </summary>
|
|
public Location AsLocation => _AsLocation;
|
|
|
|
/// <summary>
|
|
/// The type of the catch variable, if any.
|
|
/// </summary>
|
|
public TypeName ExceptionType => _ExceptionType;
|
|
|
|
/// <summary>
|
|
/// The location of the 'When', if any.
|
|
/// </summary>
|
|
public Location WhenLocation => _WhenLocation;
|
|
|
|
/// <summary>
|
|
/// The filter expression, if any.
|
|
/// </summary>
|
|
public Expression FilterExpression => _FilterExpression;
|
|
|
|
/// <summary>
|
|
/// Constructs a new parse tree for a Catch statement.
|
|
/// </summary>
|
|
/// <param name="name">The name of the catch variable, if any.</param>
|
|
/// <param name="asLocation">The location of the 'As', if any.</param>
|
|
/// <param name="exceptionType">The type of the catch variable, if any.</param>
|
|
/// <param name="whenLocation">The location of the 'When', if any.</param>
|
|
/// <param name="filterExpression">The filter expression, if any.</param>
|
|
/// <param name="span">The location of the parse tree, if any.</param>
|
|
/// <param name="comments">The comments for the parse tree, if any.</param>
|
|
public CatchStatement(SimpleName name, Location asLocation, TypeName exceptionType, Location whenLocation, Expression filterExpression, Span span, IList<Comment> comments)
|
|
: base(TreeType.CatchStatement, span, comments)
|
|
{
|
|
SetParent(name);
|
|
SetParent(exceptionType);
|
|
SetParent(filterExpression);
|
|
_Name = name;
|
|
_AsLocation = asLocation;
|
|
_ExceptionType = exceptionType;
|
|
_WhenLocation = whenLocation;
|
|
_FilterExpression = filterExpression;
|
|
}
|
|
|
|
protected override void GetChildTrees(IList<Tree> childList)
|
|
{
|
|
Tree.AddChild(childList, Name);
|
|
Tree.AddChild(childList, ExceptionType);
|
|
Tree.AddChild(childList, FilterExpression);
|
|
}
|
|
}
|