aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcmd')
-rw-r--r--src/libcmd/command.cc11
-rw-r--r--src/libcmd/command.hh2
-rw-r--r--src/libcmd/repl.cc2
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);