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

57 lines
1.9 KiB
C#

using System.Collections.Generic;
namespace AspClassic.Parser;
/// <summary>
/// A parse tree for a Get property accessor.
/// </summary>
public sealed class GetAccessorDeclaration : ModifiedDeclaration
{
private readonly Location _GetLocation;
private readonly StatementCollection _Statements;
private readonly EndBlockDeclaration _EndDeclaration;
/// <summary>
/// The location of the 'Get'.
/// </summary>
public Location GetLocation => _GetLocation;
/// <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 Get 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="getLocation">The location of the 'Get'.</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 GetAccessorDeclaration(AttributeBlockCollection attributes, ModifierCollection modifiers, Location getLocation, StatementCollection statements, EndBlockDeclaration endDeclaration, Span span, IList<Comment> comments)
: base(TreeType.GetAccessorDeclaration, attributes, modifiers, span, comments)
{
SetParent(statements);
SetParent(endDeclaration);
_GetLocation = getLocation;
_Statements = statements;
_EndDeclaration = endDeclaration;
}
protected override void GetChildTrees(IList<Tree> childList)
{
base.GetChildTrees(childList);
Tree.AddChild(childList, Statements);
Tree.AddChild(childList, EndDeclaration);
}
}