summary refs log tree commit diff stats
path: root/lib/system/fatal.nim
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2022-11-01 14:56:32 +0800
committerGitHub <noreply@github.com>2022-11-01 07:56:32 +0100
commitd735c447d35948ef6fda8270d1665cbd66c4636a (patch)
tree7d125f6c7bf5887b8b8d13acaaef6a6db6a8f06d /lib/system/fatal.nim
parent49e793e8c4b42a5bc08bc6ed27123389c3bdc353 (diff)
downloadNim-d735c447d35948ef6fda8270d1665cbd66c4636a.tar.gz
make `system/fatal` importable (#20719)
Diffstat (limited to 'lib/system/fatal.nim')
-rw-r--r--lib/system/fatal.nim19
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/system/fatal.nim b/lib/system/fatal.nim
index c01787a32..6e2edf573 100644
--- a/lib/system/fatal.nim
+++ b/lib/system/fatal.nim
@@ -9,27 +9,22 @@
 
 {.push profiler: off.}
 
-when defined(nimHasExceptionsQuery):
-  const gotoBasedExceptions = compileOption("exceptions", "goto")
-else:
-  const gotoBasedExceptions = false
-
 when hostOS == "standalone":
   include "$projectpath/panicoverride"
 
-  func sysFatal(exceptn: typedesc, message: string) {.inline.} =
+  func sysFatal*(exceptn: typedesc, message: string) {.inline.} =
     panic(message)
 
-  func sysFatal(exceptn: typedesc, message, arg: string) {.inline.} =
+  func sysFatal*(exceptn: typedesc, message, arg: string) {.inline.} =
     rawoutput(message)
     panic(arg)
 
 elif (defined(nimQuirky) or defined(nimPanics)) and not defined(nimscript):
-  import ansi_c
+  import system/ansi_c
 
   func name(t: typedesc): string {.magic: "TypeTrait".}
 
-  func sysFatal(exceptn: typedesc, message, arg: string) {.inline, noreturn.} =
+  func sysFatal*(exceptn: typedesc, message, arg: string) {.inline, noreturn.} =
     when nimvm:
       # TODO when doAssertRaises works in CT, add a test for it
       raise (ref exceptn)(msg: message & arg)
@@ -46,14 +41,14 @@ elif (defined(nimQuirky) or defined(nimPanics)) and not defined(nimscript):
         cstderr.rawWrite buf
       quit 1
 
-  func sysFatal(exceptn: typedesc, message: string) {.inline, noreturn.} =
+  func sysFatal*(exceptn: typedesc, message: string) {.inline, noreturn.} =
     sysFatal(exceptn, message, "")
 
 else:
-  func sysFatal(exceptn: typedesc, message: string) {.inline, noreturn.} =
+  func sysFatal*(exceptn: typedesc, message: string) {.inline, noreturn.} =
     raise (ref exceptn)(msg: message)
 
-  func sysFatal(exceptn: typedesc, message, arg: string) {.inline, noreturn.} =
+  func sysFatal*(exceptn: typedesc, message, arg: string) {.inline, noreturn.} =
     raise (ref exceptn)(msg: message & arg)
 
 {.pop.}