mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Fixed static init issues with CheckErrorHandler
This commit is contained in:
parent
9a10641680
commit
6160d4e6ac
2 changed files with 35 additions and 5 deletions
|
@ -85,10 +85,19 @@ namespace System
|
|||
|
||||
static void SetupOutStringEx()
|
||||
{
|
||||
OutString = => OutString_Ex;
|
||||
sOutString = => OutString_Ex;
|
||||
}
|
||||
|
||||
static function void(StringView str) OutString = => OutString_Simple;
|
||||
static function void(StringView str) sOutString;
|
||||
static function void(StringView str) OutString
|
||||
{
|
||||
get
|
||||
{
|
||||
if (sOutString == null)
|
||||
sOutString = => OutString_Simple;
|
||||
return sOutString;
|
||||
}
|
||||
}
|
||||
|
||||
#if !BF_RUNTIME_DISABLE && !BF_PLATFORM_WASM
|
||||
private static extern void PutChars(char8* c, int32 len);
|
||||
|
|
|
@ -14,7 +14,6 @@ namespace System
|
|||
public bool AVX, AVX2, AVX512;
|
||||
}
|
||||
|
||||
[StaticInitPriority(201)]
|
||||
static class Runtime
|
||||
{
|
||||
const int32 cVersion = 10;
|
||||
|
@ -284,7 +283,7 @@ namespace System
|
|||
mDebugMessageData_SetupProfilerCmd = => DebugMessageData_SetupProfilerCmd;
|
||||
mDebugMessageData_Fatal = => DebugMessageData_Fatal;
|
||||
mDebugMessageData_Clear = => DebugMessageData_Clear;
|
||||
mCheckErrorHandler = => CheckErrorHandler;
|
||||
mCheckErrorHandler = => CheckErrorHandler_Thunk;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -389,13 +388,23 @@ namespace System
|
|||
public static bool sInsideErrorHandler;
|
||||
}
|
||||
|
||||
|
||||
[AlwaysInclude, StaticInitPriority(201)]
|
||||
static struct RuntimeInit
|
||||
{
|
||||
public static this()
|
||||
{
|
||||
Runtime.Init();
|
||||
}
|
||||
}
|
||||
|
||||
static RtFlags sExtraFlags;
|
||||
static bool sQueriedFeatures = false;
|
||||
static RuntimeFeatures sFeatures;
|
||||
|
||||
static function void() sThreadInit;
|
||||
|
||||
public static this()
|
||||
static void Init()
|
||||
{
|
||||
#if !BF_RUNTIME_DISABLE
|
||||
BfRtCallbacks.sCallbacks.Init();
|
||||
|
@ -422,6 +431,11 @@ namespace System
|
|||
#endif
|
||||
}
|
||||
|
||||
public static this()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[NoReturn]
|
||||
public static void FatalError(String msg = "Fatal error encountered", String filePath = Compiler.CallerFilePath, int line = Compiler.CallerLineNum)
|
||||
{
|
||||
|
@ -497,6 +511,13 @@ namespace System
|
|||
public static function int32(char8* kind, char8* arg1, char8* arg2, int arg3) CheckErrorHandler;
|
||||
public static function void*(char8* filePath) LibraryLoadCallback;
|
||||
|
||||
public static int32 CheckErrorHandler_Thunk(char8* kind, char8* arg1, char8* arg2, int arg3)
|
||||
{
|
||||
if (CheckErrorHandler != null)
|
||||
return CheckErrorHandler(kind, arg1, arg2, arg3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ErrorHandlerResult CheckAssertError_Impl(AssertError.Kind kind, String error, String filePath, int lineNum)
|
||||
{
|
||||
return CheckErrorHandlers(scope AssertError(kind, error, filePath, lineNum));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue