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

34 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
namespace AspClassic.Parser;
/// <summary>
/// A read-only collection of attributes.
/// </summary>
public sealed class AttributeCollection : CommaDelimitedTreeCollection<Attribute>
{
private readonly Location _RightBracketLocation;
/// <summary>
/// The location of the '}'.
/// </summary>
public Location RightBracketLocation => _RightBracketLocation;
/// <summary>
/// Constructs a new collection of attributes.
/// </summary>
/// <param name="attributes">The attributes in the collection.</param>
/// <param name="commaLocations">The location of the commas in the list.</param>
/// <param name="rightBracketLocation">The location of the right bracket.</param>
/// <param name="span">The location of the parse tree.</param>
public AttributeCollection(IList<Attribute> attributes, IList<Location> commaLocations, Location rightBracketLocation, Span span)
: base(TreeType.AttributeCollection, attributes, commaLocations, span)
{
if (attributes == null || attributes.Count == 0)
{
throw new ArgumentException("AttributeCollection cannot be empty.");
}
_RightBracketLocation = rightBracketLocation;
}
}