aspclassic-core/AspClassic.Parser/LabelReferenceStatement.cs
Jelle Luteijn 484dbfc9d9 progress
2022-05-15 11:19:49 +02:00

39 lines
1 KiB
C#

#define DEBUG
using System.Collections.Generic;
using System.Diagnostics;
namespace AspClassic.Parser;
/// <summary>
/// A parse tree for a statement that refers to a label.
/// </summary>
public abstract class LabelReferenceStatement : Statement
{
private readonly SimpleName _Name;
private readonly bool _IsLineNumber;
/// <summary>
/// The name of the label being referred to.
/// </summary>
public SimpleName Name => _Name;
/// <summary>
/// Whether the label is a line number.
/// </summary>
public bool IsLineNumber => _IsLineNumber;
protected LabelReferenceStatement(TreeType type, SimpleName name, bool isLineNumber, Span span, IList<Comment> comments)
: base(type, span, comments)
{
Debug.Assert(type == TreeType.GotoStatement || type == TreeType.LabelStatement || type == TreeType.OnErrorStatement || type == TreeType.ResumeStatement);
SetParent(name);
_Name = name;
_IsLineNumber = isLineNumber;
}
protected override void GetChildTrees(IList<Tree> childList)
{
Tree.AddChild(childList, Name);
}
}