50 lines
1.9 KiB
C#
50 lines
1.9 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// A parse tree for an Enum declaration.
|
|
/// </summary>
|
|
public sealed class EnumDeclaration : BlockDeclaration
|
|
{
|
|
private readonly Location _AsLocation;
|
|
|
|
private readonly TypeName _ElementType;
|
|
|
|
/// <summary>
|
|
/// The location of the 'As', if any.
|
|
/// </summary>
|
|
public Location AsLocation => _AsLocation;
|
|
|
|
/// <summary>
|
|
/// The element type of the enumerated type, if any.
|
|
/// </summary>
|
|
public TypeName ElementType => _ElementType;
|
|
|
|
/// <summary>
|
|
/// Constructs a parse tree for an Enum declaration.
|
|
/// </summary>
|
|
/// <param name="attributes">The attributes for the parse tree.</param>
|
|
/// <param name="modifiers">The modifiers for the parse tree.</param>
|
|
/// <param name="keywordLocation">The location of the keyword.</param>
|
|
/// <param name="name">The name of the declaration.</param>
|
|
/// <param name="asLocation">The location of the 'As', if any.</param>
|
|
/// <param name="elementType">The element type of the enumerated type, if any.</param>
|
|
/// <param name="declarations">The enumerated values.</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 EnumDeclaration(AttributeBlockCollection attributes, ModifierCollection modifiers, Location keywordLocation, SimpleName name, Location asLocation, TypeName elementType, DeclarationCollection declarations, EndBlockDeclaration endStatement, Span span, IList<Comment> comments)
|
|
: base(TreeType.EnumDeclaration, attributes, modifiers, keywordLocation, name, declarations, endStatement, span, comments)
|
|
{
|
|
SetParent(elementType);
|
|
_AsLocation = asLocation;
|
|
_ElementType = elementType;
|
|
}
|
|
|
|
protected override void GetChildTrees(IList<Tree> childList)
|
|
{
|
|
base.GetChildTrees(childList);
|
|
Tree.AddChild(childList, ElementType);
|
|
}
|
|
}
|