Files
2026-08-27 10:56:38 -06:00

29 lines
690 B
C#

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