using System.Collections.Generic;
namespace AspClassic.Parser;
///
/// A parse tree for a AddHandler property accessor.
///
public sealed class AddHandlerAccessorDeclaration : ModifiedDeclaration
{
private readonly Location _AddHandlerLocation;
private readonly ParameterCollection _Parameters;
private readonly StatementCollection _Statements;
private readonly EndBlockDeclaration _EndStatement;
///
/// The location of the 'AddHandler'.
///
public Location AddHandlerLocation => _AddHandlerLocation;
///
/// The accessor's parameters.
///
public ParameterCollection Parameters => _Parameters;
///
/// The statements in the accessor.
///
public StatementCollection Statements => _Statements;
///
/// The End declaration for the accessor.
///
public EndBlockDeclaration EndStatement => _EndStatement;
///
/// Constructs a new parse tree for a property accessor.
///
/// The attributes for the parse tree.
/// The location of the 'AddHandler'.
/// The parameters of the declaration.
/// The statements in the declaration.
/// The end block declaration, if any.
/// The location of the parse tree.
/// The comments for the parse tree.
public AddHandlerAccessorDeclaration(AttributeBlockCollection attributes, Location addHandlerLocation, ParameterCollection parameters, StatementCollection statements, EndBlockDeclaration endStatement, Span span, IList comments)
: base(TreeType.AddHandlerAccessorDeclaration, attributes, null, span, comments)
{
SetParent(parameters);
SetParent(statements);
SetParent(endStatement);
_Parameters = parameters;
_AddHandlerLocation = addHandlerLocation;
_Statements = statements;
_EndStatement = endStatement;
}
protected override void GetChildTrees(IList childList)
{
base.GetChildTrees(childList);
Tree.AddChild(childList, Parameters);
Tree.AddChild(childList, Statements);
Tree.AddChild(childList, EndStatement);
}
}