mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-13 01:36:15 +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);
|
auto repl = std::make_unique<NixRepl>(evalState);
|
||||||
|
|
||||||
// repl->debugError = debugError;
|
repl->debugError = debugError;
|
||||||
|
|
||||||
repl->initEnv();
|
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.
|
// add 'extra' vars.
|
||||||
std::set<std::string> names;
|
std::set<std::string> names;
|
||||||
for (auto & [name, value] : extraEnv) {
|
for (auto & [name, value] : extraEnv) {
|
||||||
|
|
|
@ -699,6 +699,7 @@ static RegisterPrimOp primop_genericClosure(RegisterPrimOp::Info {
|
||||||
.fun = prim_genericClosure,
|
.fun = prim_genericClosure,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
static RegisterPrimOp primop_break({
|
static RegisterPrimOp primop_break({
|
||||||
.name = "break",
|
.name = "break",
|
||||||
.args = {"v"},
|
.args = {"v"},
|
||||||
|
@ -707,17 +708,15 @@ static RegisterPrimOp primop_break({
|
||||||
)",
|
)",
|
||||||
.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;
|
auto error = Error(ErrorInfo{
|
||||||
// PathSet context;
|
.level = lvlInfo,
|
||||||
// string s = state.coerceToString(pos, *args[0], context);
|
.msg = hintfmt("breakpoint reached; value was %1%", *args[0]),
|
||||||
|
.errPos = pos,
|
||||||
|
});
|
||||||
if (debuggerHook && !state.debugTraces.empty())
|
if (debuggerHook && !state.debugTraces.empty())
|
||||||
{
|
{
|
||||||
auto &dt = state.debugTraces.front();
|
auto &dt = state.debugTraces.front();
|
||||||
// std::optional<ErrPos> pos;
|
debuggerHook(&error, dt.env, dt.expr);
|
||||||
// const Expr &expr;
|
|
||||||
// const Env &env;
|
|
||||||
// hintformat hint;
|
|
||||||
debuggerHook(nullptr, dt.env, dt.expr);
|
|
||||||
|
|
||||||
// returning the value we were passed.
|
// returning the value we were passed.
|
||||||
v = *args[0];
|
v = *args[0];
|
||||||
|
|
Loading…
Reference in a new issue