This commit is contained in:
Jelle Luteijn 2022-05-15 11:19:49 +02:00
parent 16e76d6b31
commit 484dbfc9d9
529 changed files with 113694 additions and 0 deletions

View file

@ -0,0 +1,38 @@
#define DEBUG
using System.Collections.Generic;
using System.Diagnostics;
namespace AspClassic.Parser;
/// <summary>
/// A parse tree for an expression statement.
/// </summary>
public abstract class ExpressionStatement : Statement
{
private readonly Expression _Expression;
/// <summary>
/// The expression.
/// </summary>
public Expression Expression => _Expression;
/// <summary>
/// Constructs a new parse tree for an expression statement.
/// </summary>
/// <param name="type">The type of the parse tree.</param>
/// <param name="expression">The expression.</param>
/// <param name="span">The location of the parse tree.</param>
/// <param name="comments">The comments for the parse tree.</param>
protected ExpressionStatement(TreeType type, Expression expression, Span span, IList<Comment> 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<Tree> childList)
{
Tree.AddChild(childList, Expression);
}
}