first whack at passing evalState as an arg to debuggerHook.
This commit is contained in:
+1
-1
@@ -1044,7 +1044,7 @@ DebugTraceStacker::DebugTraceStacker(EvalState & evalState, DebugTrace t)
|
||||
{
|
||||
evalState.debugTraces.push_front(trace);
|
||||
if (evalState.debugStop && debuggerHook)
|
||||
debuggerHook(nullptr, trace.env, trace.expr);
|
||||
debuggerHook(evalState, nullptr, trace.env, trace.expr);
|
||||
}
|
||||
|
||||
void Value::mkString(std::string_view s)
|
||||
|
||||
+2
-2
@@ -136,7 +136,7 @@ public:
|
||||
void debugThrow(const E &error, const Env & env, const Expr & expr) const
|
||||
{
|
||||
if (debuggerHook)
|
||||
debuggerHook(&error, env, expr);
|
||||
debuggerHook(*this, &error, env, expr);
|
||||
|
||||
throw error;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
// DebugTrace stack.
|
||||
if (debuggerHook && !debugTraces.empty()) {
|
||||
const DebugTrace & last = debugTraces.front();
|
||||
debuggerHook(&e, last.env, last.expr);
|
||||
debuggerHook(*this, &e, last.env, last.expr);
|
||||
}
|
||||
|
||||
throw e;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace nix {
|
||||
|
||||
/* Launch the nix debugger */
|
||||
|
||||
std::function<void(const Error * error, const Env & env, const Expr & expr)> debuggerHook;
|
||||
std::function<void(const EvalState & evalState,const Error * error, const Env & env, const Expr & expr)> debuggerHook;
|
||||
|
||||
/* Displaying abstract syntax trees. */
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ MakeError(UndefinedVarError, Error);
|
||||
MakeError(MissingArgumentError, EvalError);
|
||||
MakeError(RestrictedPathError, Error);
|
||||
|
||||
extern std::function<void(const Error * error, const Env & env, const Expr & expr)> debuggerHook;
|
||||
extern std::function<void(const EvalState & evalState, const Error * error, const Env & env, const Expr & expr)> debuggerHook;
|
||||
|
||||
/* Position objects. */
|
||||
|
||||
|
||||
@@ -765,7 +765,7 @@ static RegisterPrimOp primop_break({
|
||||
});
|
||||
|
||||
auto & dt = state.debugTraces.front();
|
||||
debuggerHook(&error, dt.env, dt.expr);
|
||||
debuggerHook(state, &error, dt.env, dt.expr);
|
||||
|
||||
if (state.debugQuit) {
|
||||
// If the user elects to quit the repl, throw an exception.
|
||||
|
||||
Reference in New Issue
Block a user