move assertions and iterators out of system.nim (#10597)
* move assertions and iterators out of system.nim * limit nimsuggest tests to the first 3 suggestions
This commit is contained in:
parent
26f48437ca
commit
2b5e48d807
9 changed files with 450 additions and 434 deletions
47
lib/system/fatal.nim
Normal file
47
lib/system/fatal.nim
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{.push profiler: off.}
|
||||
when hostOS == "standalone":
|
||||
include "$projectpath/panicoverride"
|
||||
|
||||
proc sysFatal(exceptn: typedesc, message: string) {.inline.} =
|
||||
panic(message)
|
||||
|
||||
proc sysFatal(exceptn: typedesc, message, arg: string) {.inline.} =
|
||||
rawoutput(message)
|
||||
panic(arg)
|
||||
|
||||
elif defined(nimQuirky) and not defined(nimscript):
|
||||
proc name(t: typedesc): string {.magic: "TypeTrait".}
|
||||
|
||||
proc sysFatal(exceptn: typedesc, message, arg: string) {.inline, noReturn.} =
|
||||
var buf = newStringOfCap(200)
|
||||
add(buf, "Error: unhandled exception: ")
|
||||
add(buf, message)
|
||||
add(buf, arg)
|
||||
add(buf, " [")
|
||||
add(buf, name exceptn)
|
||||
add(buf, "]")
|
||||
cstderr.rawWrite buf
|
||||
quit 1
|
||||
|
||||
proc sysFatal(exceptn: typedesc, message: string) {.inline, noReturn.} =
|
||||
sysFatal(exceptn, message, "")
|
||||
|
||||
else:
|
||||
proc sysFatal(exceptn: typedesc, message: string) {.inline, noReturn.} =
|
||||
when declared(owned):
|
||||
var e: owned(ref exceptn)
|
||||
else:
|
||||
var e: ref exceptn
|
||||
new(e)
|
||||
e.msg = message
|
||||
raise e
|
||||
|
||||
proc sysFatal(exceptn: typedesc, message, arg: string) {.inline, noReturn.} =
|
||||
when declared(owned):
|
||||
var e: owned(ref exceptn)
|
||||
else:
|
||||
var e: ref exceptn
|
||||
new(e)
|
||||
e.msg = message & arg
|
||||
raise e
|
||||
{.pop.}
|
||||
Loading…
Add table
Add a link
Reference in a new issue