using System.Collections.Immutable; using System.Diagnostics; using Microsoft.CodeAnalysis.CSharp.Symbols; namespace Microsoft.CodeAnalysis.CSharp; internal sealed class BoundSwitchSection : BoundStatementList { public ImmutableArray Locals { get; } public ImmutableArray SwitchLabels { get; } public BoundSwitchSection(SyntaxNode syntax, ImmutableArray locals, ImmutableArray switchLabels, ImmutableArray statements, bool hasErrors = false) : base(BoundKind.SwitchSection, syntax, statements, hasErrors || switchLabels.HasErrors() || statements.HasErrors()) { Locals = locals; SwitchLabels = switchLabels; } [DebuggerStepThrough] public override BoundNode? Accept(BoundTreeVisitor visitor) { return visitor.VisitSwitchSection(this); } public BoundSwitchSection Update(ImmutableArray locals, ImmutableArray switchLabels, ImmutableArray statements) { if (locals != Locals || switchLabels != SwitchLabels || statements != base.Statements) { BoundSwitchSection boundSwitchSection = new BoundSwitchSection(Syntax, locals, switchLabels, statements, base.HasErrors); boundSwitchSection.CopyAttributes(this); return boundSwitchSection; } return this; } }