mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 16:26:18 +02:00
make an 'info' level error on break
This commit is contained in:
parent
4cffb130e3
commit
e761bf0601
2 changed files with 8 additions and 23 deletions
|
@ -931,24 +931,10 @@ void runRepl(
|
|||
{
|
||||
auto repl = std::make_unique<NixRepl>(evalState);
|
||||
|
||||
// repl->debugError = debugError;
|
||||
repl->debugError = debugError;
|
||||
|
||||
repl->initEnv();
|
||||
|
||||
// auto dts = debugError ?
|
||||
// std::unique_ptr<DebugTraceStacker>(
|
||||
// // tack on a final DebugTrace for the error position.
|
||||
// new DebugTraceStacker(
|
||||
// *evalState,
|
||||
// DebugTrace
|
||||
// {.pos = debugError->info().errPos,
|
||||
// .expr = expr,
|
||||
// .env = *repl->env,
|
||||
// .hint = debugError->info().msg
|
||||
// })
|
||||
// )
|
||||
// : nullptr;
|
||||
|
||||
// add 'extra' vars.
|
||||
std::set<std::string> names;
|
||||
for (auto & [name, value] : extraEnv) {
|
||||
|
|
|
@ -699,6 +699,7 @@ static RegisterPrimOp primop_genericClosure(RegisterPrimOp::Info {
|
|||
.fun = prim_genericClosure,
|
||||
});
|
||||
|
||||
|
||||
static RegisterPrimOp primop_break({
|
||||
.name = "break",
|
||||
.args = {"v"},
|
||||
|
@ -707,17 +708,15 @@ static RegisterPrimOp primop_break({
|
|||
)",
|
||||
.fun = [](EvalState & state, const Pos & pos, Value * * args, Value & v)
|
||||
{
|
||||
std::cout << "primop_break, value: " << *args[0] << std::endl;
|
||||
// PathSet context;
|
||||
// string s = state.coerceToString(pos, *args[0], context);
|
||||
auto error = Error(ErrorInfo{
|
||||
.level = lvlInfo,
|
||||
.msg = hintfmt("breakpoint reached; value was %1%", *args[0]),
|
||||
.errPos = pos,
|
||||
});
|
||||
if (debuggerHook && !state.debugTraces.empty())
|
||||
{
|
||||
auto &dt = state.debugTraces.front();
|
||||
// std::optional<ErrPos> pos;
|
||||
// const Expr &expr;
|
||||
// const Env &env;
|
||||
// hintformat hint;
|
||||
debuggerHook(nullptr, dt.env, dt.expr);
|
||||
debuggerHook(&error, dt.env, dt.expr);
|
||||
|
||||
// returning the value we were passed.
|
||||
v = *args[0];
|
||||
|
|
Loading…
Reference in a new issue