85 lines
2.5 KiB
C#
85 lines
2.5 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// A parse tree for a declaration with a signature.
|
|
/// </summary>
|
|
public abstract class SignatureDeclaration : ModifiedDeclaration
|
|
{
|
|
private readonly Location _KeywordLocation;
|
|
|
|
private readonly SimpleName _Name;
|
|
|
|
private readonly TypeParameterCollection _TypeParameters;
|
|
|
|
private readonly ParameterCollection _Parameters;
|
|
|
|
private readonly Location _AsLocation;
|
|
|
|
private readonly AttributeBlockCollection _ResultTypeAttributes;
|
|
|
|
private readonly TypeName _ResultType;
|
|
|
|
/// <summary>
|
|
/// The location of the declaration's keyword.
|
|
/// </summary>
|
|
public Location KeywordLocation => _KeywordLocation;
|
|
|
|
/// <summary>
|
|
/// The name of the declaration.
|
|
/// </summary>
|
|
public SimpleName Name => _Name;
|
|
|
|
/// <summary>
|
|
/// The type parameters on the declaration, if any.
|
|
/// </summary>
|
|
public TypeParameterCollection TypeParameters => _TypeParameters;
|
|
|
|
/// <summary>
|
|
/// The parameters of the declaration.
|
|
/// </summary>
|
|
public ParameterCollection Parameters => _Parameters;
|
|
|
|
/// <summary>
|
|
/// The location of the 'As', if any.
|
|
/// </summary>
|
|
public Location AsLocation => _AsLocation;
|
|
|
|
/// <summary>
|
|
/// The result type attributes, if any.
|
|
/// </summary>
|
|
public AttributeBlockCollection ResultTypeAttributes => _ResultTypeAttributes;
|
|
|
|
/// <summary>
|
|
/// The result type, if any.
|
|
/// </summary>
|
|
public TypeName ResultType => _ResultType;
|
|
|
|
protected SignatureDeclaration(TreeType type, AttributeBlockCollection attributes, ModifierCollection modifiers, Location keywordLocation, SimpleName name, TypeParameterCollection typeParameters, ParameterCollection parameters, Location asLocation, AttributeBlockCollection resultTypeAttributes, TypeName resultType, Span span, IList<Comment> comments)
|
|
: base(type, attributes, modifiers, span, comments)
|
|
{
|
|
SetParent(name);
|
|
SetParent(typeParameters);
|
|
SetParent(parameters);
|
|
SetParent(resultType);
|
|
SetParent(resultTypeAttributes);
|
|
_KeywordLocation = keywordLocation;
|
|
_Name = name;
|
|
_TypeParameters = typeParameters;
|
|
_Parameters = parameters;
|
|
_AsLocation = asLocation;
|
|
_ResultTypeAttributes = resultTypeAttributes;
|
|
_ResultType = resultType;
|
|
}
|
|
|
|
protected override void GetChildTrees(IList<Tree> childList)
|
|
{
|
|
base.GetChildTrees(childList);
|
|
Tree.AddChild(childList, Name);
|
|
Tree.AddChild(childList, TypeParameters);
|
|
Tree.AddChild(childList, Parameters);
|
|
Tree.AddChild(childList, ResultTypeAttributes);
|
|
Tree.AddChild(childList, ResultType);
|
|
}
|
|
}
|