remove 'debugError', dead code

This commit is contained in:
Ben Burdette 2022-04-08 13:30:18 -06:00
parent b8b8ec7101
commit a86c2a8481
3 changed files with 1 additions and 46 deletions

View file

@ -120,9 +120,6 @@ ref<EvalState> EvalCommand::getEvalState()
;
if (startReplOnEvalErrors)
debuggerHook = [evalState{ref<EvalState>(evalState)}](const Error * error, const Env & env, const Expr & expr) {
// clear the screen.
// std::cout << "\033[2J\033[1;1H";
auto dts =
error && expr.getPos() ?
std::unique_ptr<DebugTraceStacker>(
@ -137,35 +134,13 @@ ref<EvalState> EvalCommand::getEvalState()
}))
: nullptr;
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());
// else
// {
// auto iter = evalState->debugTraces.begin();
// if (iter != evalState->debugTraces.end()) {
// std::cout << "\n" << "… " << iter->hint.str() << "\n";
// if (iter->pos.has_value() && (*iter->pos)) {
// auto pos = iter->pos.value();
// std::cout << "\n";
// printAtPos(pos, std::cout);
// auto loc = getCodeLines(pos);
// if (loc.has_value()) {
// std::cout << "\n";
// printCodeLines(std::cout, "", pos, *loc);
// std::cout << "\n";
// }
// }
// }
// }
if (expr.staticenv)
{
std::unique_ptr<valmap> vm(mapStaticEnvBindings(*expr.staticenv.get(), env));
runRepl(evalState, error, expr, *vm);
runRepl(evalState, expr, *vm);
}
};
}

View file

@ -274,7 +274,6 @@ void printClosureDiff(
void runRepl(
ref<EvalState> evalState,
const Error *debugError,
const Expr &expr,
const std::map<std::string, Value *> & extraEnv);
}

View file

@ -50,7 +50,6 @@ struct NixRepl
ref<EvalState> state;
Bindings * autoArgs;
const Error *debugError;
int debugTraceIndex;
Strings loadedFiles;
@ -552,16 +551,6 @@ bool NixRepl::processLine(std::string line)
// showDebugTrace(std::cout, *iter);
}
}
else if (arg == "error") {
// TODO: remove, along with debugError.
if (this->debugError) {
showErrorInfo(std::cout, debugError->info(), true);
}
else
{
notice("error information not available");
}
}
else if (arg == "step") {
// set flag to stop at next DebugTrace; exit repl.
state->debugStop = true;
@ -1024,26 +1013,18 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
void runRepl(
ref<EvalState> evalState,
const Error *debugError,
const Expr &expr,
const std::map<std::string, Value *> & extraEnv)
{
auto repl = std::make_unique<NixRepl>(evalState);
repl->debugError = debugError;
repl->initEnv();
// add 'extra' vars.
// std::set<std::string> names;
for (auto & [name, value] : extraEnv) {
// names.insert(ANSI_BOLD + name + ANSI_NORMAL);
// names.insert(name);
repl->addVarToScope(repl->state->symbols.create(name), *value);
}
// printError(hintfmt("The following extra variables are in scope: %s\n", concatStringsSep(", ", names)).str());
repl->mainLoop({});
}