progress
This commit is contained in:
parent
16e76d6b31
commit
484dbfc9d9
529 changed files with 113694 additions and 0 deletions
38
AspClassic.Parser/UnaryExpression.cs
Normal file
38
AspClassic.Parser/UnaryExpression.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
#define DEBUG
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace AspClassic.Parser;
|
||||
|
||||
/// <summary>
|
||||
/// A parse tree for an expression that has an operand.
|
||||
/// </summary>
|
||||
public abstract class UnaryExpression : Expression
|
||||
{
|
||||
private readonly Expression _Operand;
|
||||
|
||||
/// <summary>
|
||||
/// The operand of the expression.
|
||||
/// </summary>
|
||||
public Expression Operand => _Operand;
|
||||
|
||||
public override bool IsConstant => Operand.IsConstant;
|
||||
|
||||
protected UnaryExpression(TreeType type, Expression operand, Span span)
|
||||
: base(type, span)
|
||||
{
|
||||
Debug.Assert(type == TreeType.ParentheticalExpression || type == TreeType.TypeOfExpression || type == TreeType.CTypeExpression || type == TreeType.DirectCastExpression || type == TreeType.TryCastExpression || type == TreeType.IntrinsicCastExpression || (type >= TreeType.UnaryOperatorExpression && type <= TreeType.AddressOfExpression));
|
||||
if (operand == null)
|
||||
{
|
||||
throw new ArgumentNullException("operand");
|
||||
}
|
||||
SetParent(operand);
|
||||
_Operand = operand;
|
||||
}
|
||||
|
||||
protected override void GetChildTrees(IList<Tree> childList)
|
||||
{
|
||||
Tree.AddChild(childList, Operand);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue