49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace AspClassic.Parser;
|
|
|
|
/// <summary>
|
|
/// A parse tree for a call or index expression.
|
|
/// </summary>
|
|
public sealed class CallOrIndexExpression : Expression
|
|
{
|
|
private readonly Expression _TargetExpression;
|
|
|
|
private readonly ArgumentCollection _Arguments;
|
|
|
|
/// <summary>
|
|
/// The target of the call or index.
|
|
/// </summary>
|
|
public Expression TargetExpression => _TargetExpression;
|
|
|
|
/// <summary>
|
|
/// The arguments to the call or index.
|
|
/// </summary>
|
|
public ArgumentCollection Arguments => _Arguments;
|
|
|
|
/// <summary>
|
|
/// Constructs a new parse tree for a call or index expression.
|
|
/// </summary>
|
|
/// <param name="targetExpression">The target of the call or index.</param>
|
|
/// <param name="arguments">The arguments to the call or index.</param>
|
|
/// <param name="span">The location of the parse tree.</param>
|
|
public CallOrIndexExpression(Expression targetExpression, ArgumentCollection arguments, Span span)
|
|
: base(TreeType.CallOrIndexExpression, span)
|
|
{
|
|
if (targetExpression == null)
|
|
{
|
|
throw new ArgumentNullException("targetExpression");
|
|
}
|
|
SetParent(targetExpression);
|
|
SetParent(arguments);
|
|
_TargetExpression = targetExpression;
|
|
_Arguments = arguments;
|
|
}
|
|
|
|
protected override void GetChildTrees(IList<Tree> childList)
|
|
{
|
|
Tree.AddChild(childList, TargetExpression);
|
|
Tree.AddChild(childList, Arguments);
|
|
}
|
|
}
|