using System;
using System.Collections.Generic;
namespace AspClassic.Parser;
///
/// A parse tree for a method call statement.
///
public sealed class CallStatement : Statement
{
private readonly Location _CallLocation;
private readonly Expression _TargetExpression;
private readonly ArgumentCollection _Arguments;
///
/// The location of the 'Call', if any.
///
public Location CallLocation => _CallLocation;
///
/// The target of the call.
///
public Expression TargetExpression => _TargetExpression;
///
/// The arguments to the call.
///
public ArgumentCollection Arguments => _Arguments;
///
/// Constructs a new parse tree for a method call statement.
///
/// The location of the 'Call', if any.
/// The target of the call.
/// The arguments to the call.
/// The location of the parse tree.
/// The comments of the parse tree.
public CallStatement(Location callLocation, Expression targetExpression, ArgumentCollection arguments, Span span, IList comments)
: base(TreeType.CallStatement, span, comments)
{
if (targetExpression == null)
{
throw new ArgumentNullException("targetExpression");
}
SetParent(targetExpression);
SetParent(arguments);
_CallLocation = callLocation;
_TargetExpression = targetExpression;
_Arguments = arguments;
}
protected override void GetChildTrees(IList childList)
{
Tree.AddChild(childList, TargetExpression);
Tree.AddChild(childList, Arguments);
}
}