nimeval errorHook support (#15255)

This commit is contained in:
Scott Wadden
2020-09-07 15:05:07 -03:00
committed by GitHub
parent 0b74d26d0c
commit 098a8a7c52
3 changed files with 37 additions and 16 deletions

View File

@@ -10,9 +10,9 @@
## exposes the Nim VM to clients.
import
ast, astalgo, modules, passes, condsyms,
options, sem, semdata, llstream, vm, vmdef,
modulegraphs, idents, os, pathutils, passaux,
scriptconfig
options, sem, semdata, llstream, lineinfos, vm,
vmdef, modulegraphs, idents, os, pathutils,
passaux, scriptconfig
type
Interpreter* = ref object ## Use Nim as an interpreter with this object
@@ -134,6 +134,11 @@ proc destroyInterpreter*(i: Interpreter) =
## destructor.
discard "currently nothing to do."
proc registerErrorHook*(i: Interpreter, hook:
proc (config: ConfigRef; info: TLineInfo; msg: string;
severity: Severity) {.gcsafe.}) =
i.graph.config.structuredErrorHook = hook
proc runRepl*(r: TLLRepl;
searchPaths: openArray[string];
supportNimscript: bool) =