public LabeledStatement GetLabel (string name, Block block)
{
if (labels == null)
return null;
object value;
if (!labels.TryGetValue (name, out value)) {
return null;
}
var label = value as LabeledStatement;
Block b = block;
if (label != null) {
if (label.Block == b.Original)
return label;
// TODO: Temporary workaround for the switch block implicit label block
if (label.Block.IsCompilerGenerated && label.Block.Parent == b.Original)
return label;
} else {
List<LabeledStatement> list = (List<LabeledStatement>) value;
for (int i = 0; i < list.Count; ++i) {
label = list[i];
if (label.Block == b.Original)
return label;
// TODO: Temporary workaround for the switch block implicit label block
if (label.Block.IsCompilerGenerated && label.Block.Parent == b.Original)
return label;
}
}
return null;
}