#define DEBUG using System.Collections.Generic; using System.Diagnostics; namespace AspClassic.Parser; /// /// A parse tree for an expression block statement. /// public abstract class ExpressionBlockStatement : BlockStatement { private readonly Expression _Expression; private readonly EndBlockStatement _EndStatement; /// /// The expression. /// public Expression Expression => _Expression; /// /// The End statement for the block, if any. /// public EndBlockStatement EndStatement => _EndStatement; protected ExpressionBlockStatement(TreeType type, Expression expression, StatementCollection statements, EndBlockStatement endStatement, Span span, IList comments) : base(type, statements, span, comments) { Debug.Assert(type == TreeType.WithBlockStatement || type == TreeType.SyncLockBlockStatement || type == TreeType.WhileBlockStatement || type == TreeType.UsingBlockStatement); SetParent(expression); SetParent(endStatement); _Expression = expression; _EndStatement = endStatement; } protected override void GetChildTrees(IList childList) { Tree.AddChild(childList, Expression); base.GetChildTrees(childList); Tree.AddChild(childList, EndStatement); } }