using System;
using System.Collections.Generic;
namespace AspClassic.Parser;
///
/// A parse tree for an enumerated value declaration.
///
public sealed class EnumValueDeclaration : ModifiedDeclaration
{
private readonly Name _Name;
private readonly Location _EqualsLocation;
private readonly Expression _Expression;
///
/// The name of the enumerated value.
///
public Name Name => _Name;
///
/// The location of the '=', if any.
///
public Location EqualsLocation => _EqualsLocation;
///
/// The enumerated value, if any.
///
public Expression Expression => _Expression;
///
/// Constructs a new parse tree for an enumerated value.
///
/// The attributes on the declaration.
/// The name of the declaration.
/// The location of the '=', if any.
/// The enumerated value, if any.
/// The location of the parse tree.
/// The comments for the parse tree.
public EnumValueDeclaration(AttributeBlockCollection attributes, Name name, Location equalsLocation, Expression expression, Span span, IList comments)
: base(TreeType.EnumValueDeclaration, attributes, null, span, comments)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
SetParent(name);
SetParent(expression);
_Name = name;
_EqualsLocation = equalsLocation;
_Expression = expression;
}
protected override void GetChildTrees(IList childList)
{
base.GetChildTrees(childList);
Tree.AddChild(childList, Name);
Tree.AddChild(childList, Expression);
}
}