62 lines
1.6 KiB
C#
62 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// A parse tree for a qualified name (e.g. 'foo.bar').
|
|
/// </summary>
|
|
public sealed class QualifiedName : Name
|
|
{
|
|
private readonly Name _Qualifier;
|
|
|
|
private readonly Location _DotLocation;
|
|
|
|
private readonly SimpleName _Name;
|
|
|
|
/// <summary>
|
|
/// The qualifier on the left-hand side of the dot.
|
|
/// </summary>
|
|
public Name Qualifier => _Qualifier;
|
|
|
|
/// <summary>
|
|
/// The location of the dot.
|
|
/// </summary>
|
|
public Location DotLocation => _DotLocation;
|
|
|
|
/// <summary>
|
|
/// The name on the right-hand side of the dot.
|
|
/// </summary>
|
|
public SimpleName Name => _Name;
|
|
|
|
/// <summary>
|
|
/// Constructs a new parse tree for a qualified name.
|
|
/// </summary>
|
|
/// <param name="qualifier">The qualifier on the left-hand side of the dot.</param>
|
|
/// <param name="dotLocation">The location of the dot.</param>
|
|
/// <param name="name">The name on the right-hand side of the dot.</param>
|
|
/// <param name="span">The location of the parse tree.</param>
|
|
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<Tree> childList)
|
|
{
|
|
Tree.AddChild(childList, Qualifier);
|
|
Tree.AddChild(childList, Name);
|
|
}
|
|
}
|