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 | |
parent | 86ba0a702c63b4a8ff79a07f9303318feb330642 (diff) |
first whack at passing evalState as an arg to debuggerHook.
Diffstat (limited to 'src/libcmd')
-rw-r--r-- | src/libcmd/command.cc | 11 | ||||
-rw-r--r-- | src/libcmd/command.hh | 2 | ||||
-rw-r--r-- | src/libcmd/repl.cc | 2 |
3 files changed, 8 insertions, 7 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); } }; } diff --git a/src/libcmd/command.hh b/src/libcmd/command.hh index 196bd3aaa..8b37be901 100644 --- a/src/libcmd/command.hh +++ b/src/libcmd/command.hh @@ -274,7 +274,7 @@ void printClosureDiff( void runRepl( - ref<EvalState> evalState, + EvalState & evalState, const ValMap & extraEnv); } diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index deac3d408..cb5d5bb34 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -1011,7 +1011,7 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m } void runRepl( - ref<EvalState> evalState, + EvalState& evalState, const ValMap & extraEnv) { auto repl = std::make_unique<NixRepl>(evalState); |