Browse Source

Add pretty tests for async local functions

The fixture had an iterator local function but no async local
function; the async state-machine-in-local-function shape, static
and capturing, was not covered.

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

27
ICSharpCode.Decompiler.Tests/TestCases/Pretty/LocalFunctions.cs

@ -21,6 +21,7 @@ using System.Linq; @@ -21,6 +21,7 @@ using System.Linq;
#if CS90
using System.Runtime.InteropServices;
#endif
using System.Threading.Tasks;
namespace LocalFunctions
{
@ -670,6 +671,32 @@ namespace LocalFunctions @@ -670,6 +671,32 @@ namespace LocalFunctions
}
}
public static async Task<int> AsyncLocalFunction()
{
return await GetValueAsync() + await GetValueAsync();
#if CS80
static async Task<int> GetValueAsync()
#else
async Task<int> GetValueAsync()
#endif
{
await Task.Yield();
return 1;
}
}
public static async Task<int> AsyncLocalFunctionWithCapture(int n)
{
return await AddAsync();
async Task<int> AddAsync()
{
await Task.Yield();
return n + 1;
}
}
public void WriteCapturedParameter(int i)
{
ParamWrite();

Loading…
Cancel
Save