diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-11-04 16:53:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-04 09:53:19 +0100 |
commit | 12a20b9fb67598558e60ae9ffa3ca9780c6d8cba (patch) | |
tree | d3d357aef3efc46f027106f31f696d5d5cfe58da /lib/system.nim | |
parent | 8fb172c7a62732306ada098a276fada77f8f4805 (diff) | |
download | Nim-12a20b9fb67598558e60ae9ffa3ca9780c6d8cba.tar.gz |
revert #20719; relieve `std/assertions` of the `sysFatal` dep (#20743)
* Revert "make `system/fatal` importable (#20718)" This reverts commit d735c447d35948ef6fda8270d1665cbd66c4636a. * relieve `std/assertions` of the sysFatal dep
Diffstat (limited to 'lib/system.nim')
-rw-r--r-- | lib/system.nim | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/system.nim b/lib/system.nim index e84971aa2..c670293d5 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -1637,13 +1637,8 @@ when not defined(nimscript): ## for debug builds. Since it's usually used for debugging, this ## is proclaimed to have no IO effect! - -when defined(nimHasExceptionsQuery): - const gotoBasedExceptions = compileOption("exceptions", "goto") -else: - const gotoBasedExceptions = false - -import system/fatal +when not declared(sysFatal): + include "system/fatal" when not defined(nimscript): {.push stackTrace: off, profiler: off.} @@ -1656,6 +1651,12 @@ when not defined(nimscript): when defined(nimV2): include system/arc +template newException*(exceptn: typedesc, message: string; + parentException: ref Exception = nil): untyped = + ## Creates an exception object of type `exceptn` and sets its `msg` field + ## to `message`. Returns the new exception object. + (ref exceptn)(msg: message, parent: parentException) + when not defined(nimPreviewSlimSystem): {.deprecated: "assertions is about to move out of system; use `-d:nimPreviewSlimSystem` and import `std/assertions`".} import std/assertions @@ -1863,12 +1864,6 @@ proc debugEcho*(x: varargs[typed, `$`]) {.magic: "Echo", noSideEffect, ## for debugging routines marked as `noSideEffect ## <manual.html#pragmas-nosideeffect-pragma>`_. -template newException*(exceptn: typedesc, message: string; - parentException: ref Exception = nil): untyped = - ## Creates an exception object of type `exceptn` and sets its `msg` field - ## to `message`. Returns the new exception object. - (ref exceptn)(msg: message, parent: parentException) - when hostOS == "standalone" and defined(nogc): proc nimToCStringConv(s: NimString): cstring {.compilerproc, inline.} = if s == nil or s.len == 0: result = cstring"" |