Browse Source

Add pretty test for continue inside catch within a loop

Pins the reconstruction of a continue statement in a catch block
inside a foreach loop, which used to decompile to a goto targeting
a label at the end of the loop body. #2829 reported the goto form
and can be closed.

Assisted-by: Claude:claude-fable-5:Claude Code
pull/3857/head
Siegfried Pammer 3 days ago committed by Siegfried Pammer
parent
commit
e1db6dbdb1
  1. 16
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.cs

16
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ExceptionHandling.cs

@ -501,5 +501,21 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -501,5 +501,21 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
}
#endif
public static void ContinueInCatchInForeach(int[] arr)
{
foreach (int value in arr)
{
try
{
Console.WriteLine(value);
}
catch (Exception)
{
continue;
}
Console.WriteLine("after");
}
}
}
}

Loading…
Cancel
Save