Browse Source

Fix #2291: block container end labels should be unique as well.

pull/2316/head
Siegfried Pammer 4 years ago
parent
commit
bf8166d045
  1. 9
      ICSharpCode.Decompiler/CSharp/StatementBuilder.cs

9
ICSharpCode.Decompiler/CSharp/StatementBuilder.cs

@ -390,6 +390,15 @@ namespace ICSharpCode.Decompiler.CSharp @@ -390,6 +390,15 @@ namespace ICSharpCode.Decompiler.CSharp
if (!endContainerLabels.TryGetValue(inst.TargetContainer, out string label))
{
label = "end_" + inst.TargetLabel;
if (!duplicateLabels.TryGetValue(label, out int count))
{
duplicateLabels.Add(label, 1);
}
else
{
duplicateLabels[label]++;
label += "_" + (count + 1);
}
endContainerLabels.Add(inst.TargetContainer, label);
}
return new GotoStatement(label).WithILInstruction(inst);

Loading…
Cancel
Save