diff options
author | Ben Burdette <bburdette@protonmail.com> | 2022-05-16 09:20:51 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@protonmail.com> | 2022-05-16 09:20:51 -0600 |
commit | 667074b5867ffe40e3f1c59bd8e4ebf259f86aaa (patch) | |
tree | 6ae4400c5496b74532dd3b1b0fd72a40f6f5e97f /src/libcmd/command.cc | |
parent | 86ba0a702c63b4a8ff79a07f9303318feb330642 (diff) |
first whack at passing evalState as an arg to debuggerHook.
Diffstat (limited to 'src/libcmd/command.cc')
-rw-r--r-- | src/libcmd/command.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index bf97a3de8..ee5102a6a 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -119,13 +119,14 @@ ref<EvalState> EvalCommand::getEvalState() #endif ; if (startReplOnEvalErrors) - debuggerHook = [evalState{ref<EvalState>(evalState)}](const Error * error, const Env & env, const Expr & expr) { + // debuggerHook = [evalState{ref<EvalState>(evalState)}](const Error * error, const Env & env, const Expr & expr) { + debuggerHook = [](const EvalState & evalState, const Error * error, const Env & env, const Expr & expr) { auto dts = error && expr.getPos() ? std::make_unique<DebugTraceStacker>( - *evalState, + evalState, DebugTrace { - .pos = error->info().errPos ? *error->info().errPos : evalState->positions[expr.getPos()], + .pos = error->info().errPos ? *error->info().errPos : evalState.positions[expr.getPos()], .expr = expr, .env = env, .hint = error->info().msg, @@ -137,8 +138,8 @@ ref<EvalState> EvalCommand::getEvalState() printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error->what()); if (expr.staticEnv) { - auto vm = mapStaticEnvBindings(evalState->symbols, *expr.staticEnv.get(), env); - runRepl(evalState, *vm); + auto vm = mapStaticEnvBindings(evalState.symbols, *expr.staticEnv.get(), env); + runRepl(*const_cast<EvalState*>(&evalState), *vm); } }; } |