#define DEBUG using System.Collections.Generic; using System.Diagnostics; namespace AspClassic.Parser; /// /// A parse tree for an expression statement. /// public abstract class ExpressionStatement : Statement { private readonly Expression _Expression; /// /// The expression. /// public Expression Expression => _Expression; /// /// Constructs a new parse tree for an expression statement. /// /// The type of the parse tree. /// The expression. /// The location of the parse tree. /// The comments for the parse tree. protected ExpressionStatement(TreeType type, Expression expression, Span span, IList comments) : base(type, span, comments) { Debug.Assert(type == TreeType.ReturnStatement || type == TreeType.ErrorStatement || type == TreeType.ThrowStatement); SetParent(expression); _Expression = expression; } protected override void GetChildTrees(IList childList) { Tree.AddChild(childList, Expression); } }