fix repl bug

This commit is contained in:
Ben Burdette 2022-05-05 21:23:03 -06:00
parent dea998b2f2
commit 99d69ac23f

View file

@ -506,16 +506,14 @@ bool NixRepl::processLine(std::string line)
}
else if (debuggerHook) {
if (command == ":bt" || command == ":backtrace") {
else if (debuggerHook && (command == ":bt" || command == ":backtrace")) {
for (const auto & [idx, i] : enumerate(state->debugTraces)) {
std::cout << "\n" << ANSI_BLUE << idx << ANSI_NORMAL << ": ";
showDebugTrace(std::cout, state->positions, i);
}
}
else if (command == ":env") {
else if (debuggerHook && (command == ":env")) {
for (const auto & [idx, i] : enumerate(state->debugTraces)) {
if (idx == debugTraceIndex) {
printEnvBindings(state->symbols, i.expr, i.env);
@ -524,7 +522,7 @@ bool NixRepl::processLine(std::string line)
}
}
else if (command == ":st") {
else if (debuggerHook && (command == ":st")) {
try {
// change the DebugTrace index.
debugTraceIndex = stoi(arg);
@ -542,18 +540,17 @@ bool NixRepl::processLine(std::string line)
}
}
else if (command == ":s" || command == ":step") {
else if (debuggerHook && (command == ":s" || command == ":step")) {
// set flag to stop at next DebugTrace; exit repl.
state->debugStop = true;
return false;
}
else if (command == ":c" || command == ":continue") {
else if (debuggerHook && (command == ":c" || command == ":continue")) {
// set flag to run to next breakpoint or end of program; exit repl.
state->debugStop = false;
return false;
}
}
else if (command == ":a" || command == ":add") {
Value v;