using System; using System.Collections.Generic; namespace AspClassic.Parser; /// /// A parse tree for an On Error statement. /// public sealed class OnErrorStatement : LabelReferenceStatement { private readonly OnErrorType _OnErrorType; private readonly Location _ErrorLocation; private readonly Location _ResumeOrGoToLocation; private readonly Location _NextOrZeroOrMinusLocation; private readonly Location _OneLocation; /// /// The type of On Error statement. /// public OnErrorType OnErrorType => _OnErrorType; /// /// The location of the 'Error'. /// public Location ErrorLocation => _ErrorLocation; /// /// The location of the 'Resume' or 'GoTo'. /// public Location ResumeOrGoToLocation => _ResumeOrGoToLocation; /// /// The location of the 'Next', '0' or '-', if any. /// public Location NextOrZeroOrMinusLocation => _NextOrZeroOrMinusLocation; /// /// The location of the '1', if any. /// public Location OneLocation => _OneLocation; /// /// Constructs a parse tree for an On Error statement. /// /// The type of the On Error statement. /// The location of the 'Error'. /// The location of the 'Resume' or 'GoTo'. /// The location of the 'Next', '0' or '-', if any. /// The location of the '1', if any. /// The label to branch to, if any. /// Whether the label is a line number. /// The location of the parse tree. /// The comments for the parse tree. public OnErrorStatement(OnErrorType onErrorType, Location errorLocation, Location resumeOrGoToLocation, Location nextOrZeroOrMinusLocation, Location oneLocation, SimpleName name, bool isLineNumber, Span span, IList comments) : base(TreeType.OnErrorStatement, name, isLineNumber, span, comments) { if (onErrorType < OnErrorType.Bad || onErrorType > OnErrorType.Label) { throw new ArgumentOutOfRangeException("onErrorType"); } _OnErrorType = onErrorType; _ErrorLocation = errorLocation; _ResumeOrGoToLocation = resumeOrGoToLocation; _NextOrZeroOrMinusLocation = nextOrZeroOrMinusLocation; _OneLocation = oneLocation; } protected override void GetChildTrees(IList childList) { if (OnErrorType == OnErrorType.Label) { base.GetChildTrees(childList); } } }