using System;
using System.Collections.Generic;
namespace AspClassic.Parser;
///
/// A parse tree for a call or index expression.
///
public sealed class CallOrIndexExpression : Expression
{
private readonly Expression _TargetExpression;
private readonly ArgumentCollection _Arguments;
///
/// The target of the call or index.
///
public Expression TargetExpression => _TargetExpression;
///
/// The arguments to the call or index.
///
public ArgumentCollection Arguments => _Arguments;
///
/// Constructs a new parse tree for a call or index expression.
///
/// The target of the call or index.
/// The arguments to the call or index.
/// The location of the parse tree.
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 childList)
{
Tree.AddChild(childList, TargetExpression);
Tree.AddChild(childList, Arguments);
}
}