using System;
using System.Collections.Generic;
namespace AspClassic.Parser;
///
/// A parse tree for a qualified name (e.g. 'foo.bar').
///
public sealed class QualifiedName : Name
{
private readonly Name _Qualifier;
private readonly Location _DotLocation;
private readonly SimpleName _Name;
///
/// The qualifier on the left-hand side of the dot.
///
public Name Qualifier => _Qualifier;
///
/// The location of the dot.
///
public Location DotLocation => _DotLocation;
///
/// The name on the right-hand side of the dot.
///
public SimpleName Name => _Name;
///
/// Constructs a new parse tree for a qualified name.
///
/// The qualifier on the left-hand side of the dot.
/// The location of the dot.
/// The name on the right-hand side of the dot.
/// The location of the parse tree.
public QualifiedName(Name qualifier, Location dotLocation, SimpleName name, Span span)
: base(TreeType.QualifiedName, span)
{
if (qualifier == null)
{
throw new ArgumentNullException("qualifier");
}
if (name == null)
{
throw new ArgumentNullException("name");
}
SetParent(qualifier);
SetParent(name);
_Qualifier = qualifier;
_DotLocation = dotLocation;
_Name = name;
}
protected override void GetChildTrees(IList childList)
{
Tree.AddChild(childList, Qualifier);
Tree.AddChild(childList, Name);
}
}