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

68 lines
2.3 KiB
C#

using System.Collections.Generic;
namespace AspClassic.Parser;
/// <summary>
/// A parse tree for a Set property accessor.
/// </summary>
public sealed class SetAccessorDeclaration : ModifiedDeclaration
{
private readonly Location _SetLocation;
private readonly ParameterCollection _Parameters;
private readonly StatementCollection _Statements;
private readonly EndBlockDeclaration _EndDeclaration;
/// <summary>
/// The location of the 'Set'.
/// </summary>
public Location SetLocation => _SetLocation;
/// <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 EndDeclaration => _EndDeclaration;
/// <summary>
/// Constructs a new parse tree for a property accessor.
/// </summary>
/// <param name="attributes">The attributes for the parse tree.</param>
/// <param name="modifiers">The modifiers for the parse tree.</param>
/// <param name="setLocation">The location of the 'Set'.</param>
/// <param name="parameters">The parameters of the declaration.</param>
/// <param name="statements">The statements in the declaration.</param>
/// <param name="endDeclaration">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 SetAccessorDeclaration(AttributeBlockCollection attributes, ModifierCollection modifiers, Location setLocation, ParameterCollection parameters, StatementCollection statements, EndBlockDeclaration endDeclaration, Span span, IList<Comment> comments)
: base(TreeType.SetAccessorDeclaration, attributes, modifiers, span, comments)
{
SetParent(parameters);
SetParent(statements);
SetParent(endDeclaration);
_Parameters = parameters;
_SetLocation = setLocation;
_Statements = statements;
_EndDeclaration = endDeclaration;
}
protected override void GetChildTrees(IList<Tree> childList)
{
base.GetChildTrees(childList);
Tree.AddChild(childList, Parameters);
Tree.AddChild(childList, Statements);
Tree.AddChild(childList, EndDeclaration);
}
}