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

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

/// <summary>
/// Assertion failure (static class)
/// </summary>
public static class assertion_fail {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[u.calling_assembly]
public static u.EFake DEAD_BRANCH() =>
   Raise( Assembly.GetCallingAssembly(), "Codeflow entered in a some dead branch." );

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

/// <exception cref="u.EAssertionFailed" />
[u.doesnt_return][MethodImpl( MethodImplOptions.NoInlining )]
internal static u.EFake Raise( Assembly sourceAssembly,
                               string message ) =>
   u.assertion.Raise( sourceAssembly, 1, message );

/// <exception cref="u.EAssertionFailed" />
[u.doesnt_return][MethodImpl( MethodImplOptions.NoInlining )]
internal static u.EFake Raise( Assembly sourceAssembly,
                               string messageFmt, params object?[] args ) =>
   u.assertion.Raise( sourceAssembly, 1, messageFmt, args );

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // assertion_fail

} // user_rtx (.wasm)
