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

29 lines
919 B
C#

#define DEBUG
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
namespace AspClassic.Parser;
/// <summary>
/// A collection of trees that are colon delimited.
/// </summary>
public abstract class ColonDelimitedTreeCollection<T> : TreeCollection<T> where T : Tree
{
private readonly ReadOnlyCollection<Location> _ColonLocations;
/// <summary>
/// The locations of the colons in the collection.
/// </summary>
public ReadOnlyCollection<Location> ColonLocations => _ColonLocations;
protected ColonDelimitedTreeCollection(TreeType type, IList<T> trees, IList<Location> colonLocations, Span span)
: base(type, trees, span)
{
Debug.Assert(type == TreeType.StatementCollection || type == TreeType.DeclarationCollection);
if (colonLocations != null && colonLocations.Count > 0)
{
_ColonLocations = new ReadOnlyCollection<Location>(colonLocations);
}
}
}