73 lines
2.3 KiB
C#
73 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// A parse tree for a namespace declaration.
|
|
/// </summary>
|
|
public sealed class NamespaceDeclaration : ModifiedDeclaration
|
|
{
|
|
private readonly Location _NamespaceLocation;
|
|
|
|
private readonly Name _Name;
|
|
|
|
private readonly DeclarationCollection _Declarations;
|
|
|
|
private readonly EndBlockDeclaration _EndDeclaration;
|
|
|
|
/// <summary>
|
|
/// The location of 'Namespace'.
|
|
/// </summary>
|
|
public Location NamespaceLocation => _NamespaceLocation;
|
|
|
|
/// <summary>
|
|
/// The name of the namespace.
|
|
/// </summary>
|
|
public Name Name => _Name;
|
|
|
|
/// <summary>
|
|
/// The declarations in the namespace.
|
|
/// </summary>
|
|
public DeclarationCollection Declarations => _Declarations;
|
|
|
|
/// <summary>
|
|
/// The End Namespace declaration, if any.
|
|
/// </summary>
|
|
public EndBlockDeclaration EndDeclaration => _EndDeclaration;
|
|
|
|
/// <summary>
|
|
/// Constructs a parse tree for a namespace declaration.
|
|
/// </summary>
|
|
/// <param name="attributes">The attributes on the declaration.</param>
|
|
/// <param name="modifiers">The modifiers on the declaration.</param>
|
|
/// <param name="namespaceLocation">The location of 'Namespace'.</param>
|
|
/// <param name="name">The name of the namespace.</param>
|
|
/// <param name="declarations">The declarations in the namespace.</param>
|
|
/// <param name="endDeclaration">The End Namespace statement, if any.</param>
|
|
/// <param name="span">The location of the parse tree.</param>
|
|
/// <param name="comments">The comments for the parse tree.</param>
|
|
public NamespaceDeclaration(AttributeBlockCollection attributes, ModifierCollection modifiers, Location namespaceLocation, Name name, DeclarationCollection declarations, EndBlockDeclaration endDeclaration, Span span, IList<Comment> comments)
|
|
: base(TreeType.NamespaceDeclaration, attributes, modifiers, span, comments)
|
|
{
|
|
if (name == null)
|
|
{
|
|
throw new ArgumentNullException("name");
|
|
}
|
|
SetParent(name);
|
|
SetParent(declarations);
|
|
SetParent(endDeclaration);
|
|
_NamespaceLocation = namespaceLocation;
|
|
_Name = name;
|
|
_Declarations = declarations;
|
|
_EndDeclaration = endDeclaration;
|
|
}
|
|
|
|
protected override void GetChildTrees(IList<Tree> childList)
|
|
{
|
|
base.GetChildTrees(childList);
|
|
Tree.AddChild(childList, Name);
|
|
Tree.AddChild(childList, Declarations);
|
|
Tree.AddChild(childList, EndDeclaration);
|
|
}
|
|
}
|