32 lines
919 B
C#
32 lines
919 B
C#
using System;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// A parse tree for an unary operator expression.
|
|
/// </summary>
|
|
public sealed class UnaryOperatorExpression : UnaryExpression
|
|
{
|
|
private OperatorType _Operator;
|
|
|
|
/// <summary>
|
|
/// The operator.
|
|
/// </summary>
|
|
public OperatorType Operator => _Operator;
|
|
|
|
/// <summary>
|
|
/// Constructs a new unary operator expression parse tree.
|
|
/// </summary>
|
|
/// <param name="operator">The type of the unary operator.</param>
|
|
/// <param name="operand">The operand of the operator.</param>
|
|
/// <param name="span">The location of the parse tree.</param>
|
|
public UnaryOperatorExpression(OperatorType @operator, Expression operand, Span span)
|
|
: base(TreeType.UnaryOperatorExpression, operand, span)
|
|
{
|
|
if (@operator < OperatorType.UnaryPlus || @operator > OperatorType.Not)
|
|
{
|
|
throw new ArgumentOutOfRangeException("operator");
|
|
}
|
|
_Operator = @operator;
|
|
}
|
|
}
|