mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-11 00:36:20 +02:00
print value in break
This commit is contained in:
parent
412d58f0bb
commit
3ddf864e1b
2 changed files with 7 additions and 2 deletions
|
@ -77,7 +77,8 @@ ref<EvalState> EvalCommand::getEvalState()
|
||||||
searchPath, getEvalStore(), getStore());
|
searchPath, getEvalStore(), getStore());
|
||||||
if (startReplOnEvalErrors)
|
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) {
|
||||||
std::cout << "\033[2J\033[1;1H";
|
// clear the screen.
|
||||||
|
// std::cout << "\033[2J\033[1;1H";
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error->what());
|
printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error->what());
|
||||||
|
|
|
@ -712,12 +712,13 @@ static RegisterPrimOp primop_genericClosure(RegisterPrimOp::Info {
|
||||||
|
|
||||||
static RegisterPrimOp primop_break({
|
static RegisterPrimOp primop_break({
|
||||||
.name = "break",
|
.name = "break",
|
||||||
.args = {},
|
.args = {"v"},
|
||||||
.doc = R"(
|
.doc = R"(
|
||||||
In debug mode, pause Nix expression evaluation and enter the repl.
|
In debug mode, pause Nix expression evaluation and enter the repl.
|
||||||
)",
|
)",
|
||||||
.fun = [](EvalState & state, const Pos & pos, Value * * args, Value & v)
|
.fun = [](EvalState & state, const Pos & pos, Value * * args, Value & v)
|
||||||
{
|
{
|
||||||
|
std::cout << "primop_break, value: " << *args[0] << std::endl;
|
||||||
// PathSet context;
|
// PathSet context;
|
||||||
// string s = state.coerceToString(pos, *args[0], context);
|
// string s = state.coerceToString(pos, *args[0], context);
|
||||||
if (debuggerHook && !state.debugTraces.empty())
|
if (debuggerHook && !state.debugTraces.empty())
|
||||||
|
@ -728,6 +729,9 @@ static RegisterPrimOp primop_break({
|
||||||
// const Env &env;
|
// const Env &env;
|
||||||
// hintformat hint;
|
// hintformat hint;
|
||||||
debuggerHook(nullptr, dt.env, dt.expr);
|
debuggerHook(nullptr, dt.env, dt.expr);
|
||||||
|
|
||||||
|
// returning the value we were passed.
|
||||||
|
v = *args[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue