using System.Collections.Generic; using Microsoft.CodeAnalysis.CSharp.Symbols; namespace Microsoft.CodeAnalysis.CSharp; internal abstract class LabelCollector : BoundTreeWalkerWithStackGuardWithoutRecursionOnTheLeftOfBinaryOperator { protected HashSet currentLabels; public override BoundNode VisitLabelStatement(BoundLabelStatement node) { CollectLabel(node.Label); return base.VisitLabelStatement(node); } private void CollectLabel(LabelSymbol label) { if ((object)label != null) { HashSet hashSet = currentLabels; if (hashSet == null) { hashSet = (currentLabels = new HashSet()); } hashSet.Add(label); } } }