using System;
namespace AspClassic.Parser;
///
/// A parse tree for an intrinsic conversion expression.
///
public sealed class IntrinsicCastExpression : UnaryExpression
{
private readonly IntrinsicType _IntrinsicType;
private readonly Location _LeftParenthesisLocation;
private readonly Location _RightParenthesisLocation;
///
/// The intrinsic type conversion.
///
public IntrinsicType IntrinsicType => _IntrinsicType;
///
/// The location of the '('.
///
public Location LeftParenthesisLocation => _LeftParenthesisLocation;
///
/// The location of the ')'.
///
public Location RightParenthesisLocation => _RightParenthesisLocation;
///
/// Constructs a new parse tree for an intrinsic conversion expression.
///
/// The intrinsic type conversion.
/// The location of the '('.
/// The expression to convert.
/// The location of the ')'.
/// The location of the parse tree.
public IntrinsicCastExpression(IntrinsicType intrinsicType, Location leftParenthesisLocation, Expression operand, Location rightParenthesisLocation, Span span)
: base(TreeType.IntrinsicCastExpression, operand, span)
{
if (intrinsicType < IntrinsicType.Boolean || intrinsicType > IntrinsicType.Object)
{
throw new ArgumentOutOfRangeException("intrinsicType");
}
if (operand == null)
{
throw new ArgumentNullException("operand");
}
_IntrinsicType = intrinsicType;
_LeftParenthesisLocation = leftParenthesisLocation;
_RightParenthesisLocation = rightParenthesisLocation;
}
}