summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2020-11-26 18:08:53 +0800
committerGitHub <noreply@github.com>2020-11-26 11:08:53 +0100
commite7e9007c4c061fa690c1978f118cf62badb19bd5 (patch)
tree6435e94ee93280dc4ef1d2573a15682f47c6dbcd
parent0b3a45692c26960f528f70d890f2a2d387aac120 (diff)
downloadNim-e7e9007c4c061fa690c1978f118cf62badb19bd5.tar.gz
ref #16054 undefine some stuff in JS backend (#16070)
-rw-r--r--lib/system.nim91
1 files changed, 46 insertions, 45 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 68385ef63..c13b419ef 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1897,53 +1897,54 @@ else:
 # however, stack-traces are available for most parts
 # of the code
 
-var
-  globalRaiseHook*: proc (e: ref Exception): bool {.nimcall, benign.}
-    ## With this hook you can influence exception handling on a global level.
-    ## If not nil, every 'raise' statement ends up calling this hook.
-    ##
-    ## **Warning**: Ordinary application code should never set this hook!
-    ## You better know what you do when setting this.
-    ##
-    ## If ``globalRaiseHook`` returns false, the exception is caught and does
-    ## not propagate further through the call stack.
+when notJSnotNims:
+  var
+    globalRaiseHook*: proc (e: ref Exception): bool {.nimcall, benign.}
+      ## With this hook you can influence exception handling on a global level.
+      ## If not nil, every 'raise' statement ends up calling this hook.
+      ##
+      ## **Warning**: Ordinary application code should never set this hook!
+      ## You better know what you do when setting this.
+      ##
+      ## If ``globalRaiseHook`` returns false, the exception is caught and does
+      ## not propagate further through the call stack.
 
-  localRaiseHook* {.threadvar.}: proc (e: ref Exception): bool {.nimcall, benign.}
-    ## With this hook you can influence exception handling on a
-    ## thread local level.
-    ## If not nil, every 'raise' statement ends up calling this hook.
-    ##
-    ## **Warning**: Ordinary application code should never set this hook!
-    ## You better know what you do when setting this.
-    ##
-    ## If ``localRaiseHook`` returns false, the exception
-    ## is caught and does not propagate further through the call stack.
+    localRaiseHook* {.threadvar.}: proc (e: ref Exception): bool {.nimcall, benign.}
+      ## With this hook you can influence exception handling on a
+      ## thread local level.
+      ## If not nil, every 'raise' statement ends up calling this hook.
+      ##
+      ## **Warning**: Ordinary application code should never set this hook!
+      ## You better know what you do when setting this.
+      ##
+      ## If ``localRaiseHook`` returns false, the exception
+      ## is caught and does not propagate further through the call stack.
 
-  outOfMemHook*: proc () {.nimcall, tags: [], benign, raises: [].}
-    ## Set this variable to provide a procedure that should be called
-    ## in case of an `out of memory`:idx: event. The standard handler
-    ## writes an error message and terminates the program.
-    ##
-    ## `outOfMemHook` can be used to raise an exception in case of OOM like so:
-    ##
-    ## .. code-block:: Nim
-    ##
-    ##   var gOutOfMem: ref EOutOfMemory
-    ##   new(gOutOfMem) # need to be allocated *before* OOM really happened!
-    ##   gOutOfMem.msg = "out of memory"
-    ##
-    ##   proc handleOOM() =
-    ##     raise gOutOfMem
-    ##
-    ##   system.outOfMemHook = handleOOM
-    ##
-    ## If the handler does not raise an exception, ordinary control flow
-    ## continues and the program is terminated.
-  unhandledExceptionHook*: proc (e: ref Exception) {.nimcall, tags: [], benign, raises: [].}
-    ## Set this variable to provide a procedure that should be called
-    ## in case of an `unhandle exception` event. The standard handler
-    ## writes an error message and terminates the program, except when
-    ## using `--os:any`
+    outOfMemHook*: proc () {.nimcall, tags: [], benign, raises: [].}
+      ## Set this variable to provide a procedure that should be called
+      ## in case of an `out of memory`:idx: event. The standard handler
+      ## writes an error message and terminates the program.
+      ##
+      ## `outOfMemHook` can be used to raise an exception in case of OOM like so:
+      ##
+      ## .. code-block:: Nim
+      ##
+      ##   var gOutOfMem: ref EOutOfMemory
+      ##   new(gOutOfMem) # need to be allocated *before* OOM really happened!
+      ##   gOutOfMem.msg = "out of memory"
+      ##
+      ##   proc handleOOM() =
+      ##     raise gOutOfMem
+      ##
+      ##   system.outOfMemHook = handleOOM
+      ##
+      ## If the handler does not raise an exception, ordinary control flow
+      ## continues and the program is terminated.
+    unhandledExceptionHook*: proc (e: ref Exception) {.nimcall, tags: [], benign, raises: [].}
+      ## Set this variable to provide a procedure that should be called
+      ## in case of an `unhandle exception` event. The standard handler
+      ## writes an error message and terminates the program, except when
+      ## using `--os:any`
 
 type
   PFrame* = ptr TFrame  ## Represents a runtime frame of the call stack;