//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// UserRTX.NET satellite library | Author: Sergei Y.Kitáev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Reflection;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;

#if !WASM
namespace user_rtx { using u = user_rtx;
#else
namespace user_rtx.wasm { using u = user_rtx.wasm;
#endif

static partial class debug {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[MethodImpl(MethodImplOptions.NoInlining)]
public static Task Do_A( string blockName, Func<Task> blockA ) =>
   u.trace.Do_A( u.assembly.IsConfiguredForDebug( Assembly.GetCallingAssembly() ),
                 blockName, blockA );

/// <exception cref="ArgumentNullException" />
[MethodImpl(MethodImplOptions.NoInlining)]
public static Task Do_A( [u.req] MethodBase? method, Func<Task> blockA ) =>
   u.trace.Do_A( u.assembly.IsConfiguredForDebug( Assembly.GetCallingAssembly() ),
                 method, blockA );
/// <exception cref="ArgumentNullException" />
[MethodImpl(MethodImplOptions.NoInlining)]
public static Task Do_A( [u.req] MethodBase? method, bool expanded, Func<Task> blockA ) =>
   u.trace.Do_A( u.assembly.IsConfiguredForDebug( Assembly.GetCallingAssembly() ),
                 method, expanded, blockA );

/// <exception cref="ArgumentException" />
[MethodImpl(MethodImplOptions.NoInlining)]
public static Task Do_A( Type objectType, Func<Task> blockA,
                         [CallerMemberName] string memberName = "" ) =>
   u.trace.Do_A( u.assembly.IsConfiguredForDebug( Assembly.GetCallingAssembly() ),
                 objectType, blockA, memberName );

//==================================================================================================

[MethodImpl(MethodImplOptions.NoInlining)]
public static Task Do_A( bool condition, string blockName, Func<Task> blockA ) =>
   u.trace.Do_A( condition && u.assembly.IsConfiguredForDebug( Assembly.GetCallingAssembly() ),
                 blockName, blockA );

/// <exception cref="ArgumentNullException" />
[MethodImpl(MethodImplOptions.NoInlining)]
public static Task Do_A( bool condition, [u.req] MethodBase? method, Func<Task> blockA ) =>
   u.trace.Do_A( condition && u.assembly.IsConfiguredForDebug( Assembly.GetCallingAssembly() ),
                 method, blockA );
/// <exception cref="ArgumentNullException" />
[MethodImpl(MethodImplOptions.NoInlining)]
public static Task Do_A( bool condition, [u.req] MethodBase? method, bool expanded,
                         Func<Task> blockA ) =>
   u.trace.Do_A( condition && u.assembly.IsConfiguredForDebug( Assembly.GetCallingAssembly() ),
                 method, expanded, blockA );

/// <exception cref="ArgumentException" />
[MethodImpl(MethodImplOptions.NoInlining)]
public static Task Do_A( bool condition, Type objectType, Func<Task> blockA,
                         [CallerMemberName] string memberName = "" ) =>
   u.trace.Do_A( condition && u.assembly.IsConfiguredForDebug( Assembly.GetCallingAssembly() ),
                 objectType, blockA, memberName );

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // debug

} // user_rtx (.wasm)
