using System;
using System.Collections.Generic;
namespace AspClassic.Parser;
///
/// A parse tree for a local declaration statement.
///
public sealed class LocalDeclarationStatement : Statement
{
private readonly ModifierCollection _Modifiers;
private readonly VariableDeclaratorCollection _VariableDeclarators;
///
/// The statement modifiers.
///
public ModifierCollection Modifiers => _Modifiers;
///
/// The variable declarators.
///
public VariableDeclaratorCollection VariableDeclarators => _VariableDeclarators;
///
/// Constructs a new parse tree for a local declaration statement.
///
/// The statement modifiers.
/// The variable declarators.
/// The location of the parse tree.
/// The comments for the parse tree.
public LocalDeclarationStatement(ModifierCollection modifiers, VariableDeclaratorCollection variableDeclarators, Span span, IList comments)
: base(TreeType.LocalDeclarationStatement, span, comments)
{
if (modifiers == null)
{
throw new ArgumentNullException("modifers");
}
if (variableDeclarators == null)
{
throw new ArgumentNullException("variableDeclarators");
}
SetParent(modifiers);
SetParent(variableDeclarators);
_Modifiers = modifiers;
_VariableDeclarators = variableDeclarators;
}
protected override void GetChildTrees(IList childList)
{
Tree.AddChild(childList, Modifiers);
Tree.AddChild(childList, VariableDeclarators);
}
}