using System.Collections.Generic; namespace AspClassic.Parser; /// /// A parse tree for a declaration with a signature. /// 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; /// /// The location of the declaration's keyword. /// public Location KeywordLocation => _KeywordLocation; /// /// The name of the declaration. /// public SimpleName Name => _Name; /// /// The type parameters on the declaration, if any. /// public TypeParameterCollection TypeParameters => _TypeParameters; /// /// The parameters of the declaration. /// public ParameterCollection Parameters => _Parameters; /// /// The location of the 'As', if any. /// public Location AsLocation => _AsLocation; /// /// The result type attributes, if any. /// public AttributeBlockCollection ResultTypeAttributes => _ResultTypeAttributes; /// /// The result type, if any. /// 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 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 childList) { base.GetChildTrees(childList); Tree.AddChild(childList, Name); Tree.AddChild(childList, TypeParameters); Tree.AddChild(childList, Parameters); Tree.AddChild(childList, ResultTypeAttributes); Tree.AddChild(childList, ResultType); } }