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

67 lines
2.2 KiB
C#

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