62 lines
2.3 KiB
C#
62 lines
2.3 KiB
C#
#define DEBUG
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// A parse tree for a Sub, Function or constructor declaration.
|
|
/// </summary>
|
|
public abstract class MethodDeclaration : SignatureDeclaration
|
|
{
|
|
private readonly NameCollection _ImplementsList;
|
|
|
|
private readonly NameCollection _HandlesList;
|
|
|
|
private readonly StatementCollection _Statements;
|
|
|
|
private readonly EndBlockDeclaration _EndDeclaration;
|
|
|
|
/// <summary>
|
|
/// The list of implemented members.
|
|
/// </summary>
|
|
public NameCollection ImplementsList => _ImplementsList;
|
|
|
|
/// <summary>
|
|
/// The events that the declaration handles.
|
|
/// </summary>
|
|
public NameCollection HandlesList => _HandlesList;
|
|
|
|
/// <summary>
|
|
/// The statements in the declaration.
|
|
/// </summary>
|
|
public StatementCollection Statements => _Statements;
|
|
|
|
/// <summary>
|
|
/// The end block declaration, if any.
|
|
/// </summary>
|
|
public EndBlockDeclaration EndDeclaration => _EndDeclaration;
|
|
|
|
protected MethodDeclaration(TreeType type, AttributeBlockCollection attributes, ModifierCollection modifiers, Location keywordLocation, SimpleName name, TypeParameterCollection typeParameters, ParameterCollection parameters, Location asLocation, AttributeBlockCollection resultTypeAttributes, TypeName resultType, NameCollection implementsList, NameCollection handlesList, StatementCollection statements, EndBlockDeclaration endDeclaration, Span span, IList<Comment> comments)
|
|
: base(type, attributes, modifiers, keywordLocation, name, typeParameters, parameters, asLocation, resultTypeAttributes, resultType, span, comments)
|
|
{
|
|
Debug.Assert(type == TreeType.SubDeclaration || type == TreeType.FunctionDeclaration || type == TreeType.ConstructorDeclaration || type == TreeType.OperatorDeclaration);
|
|
SetParent(statements);
|
|
SetParent(endDeclaration);
|
|
SetParent(handlesList);
|
|
SetParent(implementsList);
|
|
_ImplementsList = implementsList;
|
|
_HandlesList = handlesList;
|
|
_Statements = statements;
|
|
_EndDeclaration = endDeclaration;
|
|
}
|
|
|
|
protected override void GetChildTrees(IList<Tree> childList)
|
|
{
|
|
base.GetChildTrees(childList);
|
|
Tree.AddChild(childList, ImplementsList);
|
|
Tree.AddChild(childList, HandlesList);
|
|
Tree.AddChild(childList, Statements);
|
|
Tree.AddChild(childList, EndDeclaration);
|
|
}
|
|
}
|