using System.Collections.Generic; namespace AspClassic.Parser; /// /// A parse tree for a Catch statement. /// 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; /// /// The name of the catch variable, if any. /// public SimpleName Name => _Name; /// /// The location of the 'As', if any. /// public Location AsLocation => _AsLocation; /// /// The type of the catch variable, if any. /// public TypeName ExceptionType => _ExceptionType; /// /// The location of the 'When', if any. /// public Location WhenLocation => _WhenLocation; /// /// The filter expression, if any. /// public Expression FilterExpression => _FilterExpression; /// /// Constructs a new parse tree for a Catch statement. /// /// The name of the catch variable, if any. /// The location of the 'As', if any. /// The type of the catch variable, if any. /// The location of the 'When', if any. /// The filter expression, if any. /// The location of the parse tree, if any. /// The comments for the parse tree, if any. public CatchStatement(SimpleName name, Location asLocation, TypeName exceptionType, Location whenLocation, Expression filterExpression, Span span, IList 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 childList) { Tree.AddChild(childList, Name); Tree.AddChild(childList, ExceptionType); Tree.AddChild(childList, FilterExpression); } }