Files
Nim/compiler/debugutils.nim
Timothee Cour 6ab5816866 add compiler/debugutils.nim to help debugging compiler (#17652)
* add compiler/debugutils.nim

* address comments
2021-04-06 22:01:34 +02:00

20 lines
490 B
Nim

##[
Utilities to help with debugging nim compiler.
Experimental API, subject to change.
]##
import options
var conf0: ConfigRef
proc onNewConfigRef*(conf: ConfigRef) {.inline.} =
## Caches `conf`, which can be retrieved with `getConfigRef`.
## This avoids having to forward `conf` all the way down the call chain to
## procs that need it during a debugging session.
conf0 = conf
proc getConfigRef*(): ConfigRef =
## nil, if -d:nimDebugUtils wasn't specified
result = conf0