1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

refactor: Extract EvalState::{runDebugRepl,canDebug}

This commit is contained in:
Robert Hensing 2024-05-01 23:02:43 +02:00
parent da82d67022
commit c07500e14d
4 changed files with 37 additions and 15 deletions

View file

@ -785,6 +785,24 @@ public:
}
};
bool EvalState::canDebug()
{
return debugRepl && !debugTraces.empty();
}
void EvalState::runDebugRepl(const Error * error)
{
if (!canDebug())
return;
assert(!debugTraces.empty());
const DebugTrace & last = debugTraces.front();
const Env & env = last.env;
const Expr & expr = last.expr;
runDebugRepl(error, env, expr);
}
void EvalState::runDebugRepl(const Error * error, const Env & env, const Expr & expr)
{
// Make sure we have a debugger to run and we're not already in a debugger.