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 an Imports statement that aliases a type or namespace.
|
|
/// </summary>
|
|
public sealed class AliasImport : Import
|
|
{
|
|
private readonly SimpleName _Name;
|
|
|
|
private readonly Location _EqualsLocation;
|
|
|
|
private readonly TypeName _AliasedTypeName;
|
|
|
|
/// <summary>
|
|
/// The alias name.
|
|
/// </summary>
|
|
public SimpleName Name => _Name;
|
|
|
|
/// <summary>
|
|
/// The location of the '='.
|
|
/// </summary>
|
|
public Location EqualsLocation => _EqualsLocation;
|
|
|
|
/// <summary>
|
|
/// The name being aliased.
|
|
/// </summary>
|
|
public TypeName AliasedTypeName => _AliasedTypeName;
|
|
|
|
/// <summary>
|
|
/// Constructs a new aliased import parse tree.
|
|
/// </summary>
|
|
/// <param name="name">The name of the alias.</param>
|
|
/// <param name="equalsLocation">The location of the '='.</param>
|
|
/// <param name="aliasedTypeName">The name being aliased.</param>
|
|
/// <param name="span">The location of the parse tree.</param>
|
|
public AliasImport(SimpleName name, Location equalsLocation, TypeName aliasedTypeName, Span span)
|
|
: base(TreeType.AliasImport, span)
|
|
{
|
|
if (aliasedTypeName == null)
|
|
{
|
|
throw new ArgumentNullException("aliasedTypeName");
|
|
}
|
|
if (name == null)
|
|
{
|
|
throw new ArgumentNullException("name");
|
|
}
|
|
SetParent(name);
|
|
SetParent(aliasedTypeName);
|
|
_Name = name;
|
|
_EqualsLocation = equalsLocation;
|
|
_AliasedTypeName = aliasedTypeName;
|
|
}
|
|
|
|
protected override void GetChildTrees(IList<Tree> childList)
|
|
{
|
|
base.GetChildTrees(childList);
|
|
Tree.AddChild(childList, AliasedTypeName);
|
|
}
|
|
}
|