using System; using System.Collections.Generic; using System.Collections.ObjectModel; using ScriptConverter.Parser; namespace ScriptConverter.Ast.Statements { class BlockStatement : Statement { public ReadOnlyCollection Statements { get; private set; } public bool IsSwitch { get; private set; } public BlockStatement(ScriptToken start, ScriptToken end, List statements, bool isSwitch = false) : base(start, end) { if (statements == null) throw new ArgumentNullException("statements"); Statements = statements.AsReadOnly(); IsSwitch = isSwitch; } public override TStmt Accept(IAstVisitor visitor) { return visitor.Visit(this); } public override void SetParent(Statement parent) { Parent = parent; foreach (var statement in Statements) { statement.SetParent(this); } } } }