From a86c2a8481c5bedb992d7126bc342a34b9c4902e Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Fri, 8 Apr 2022 13:30:18 -0600 Subject: [PATCH] remove 'debugError', dead code --- src/libcmd/command.cc | 27 +-------------------------- src/libcmd/command.hh | 1 - src/libcmd/repl.cc | 19 ------------------- 3 files changed, 1 insertion(+), 46 deletions(-) diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 5cb8728e9..5ef3b4bc6 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -120,9 +120,6 @@ ref EvalCommand::getEvalState() ; if (startReplOnEvalErrors) debuggerHook = [evalState{ref(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( @@ -137,35 +134,13 @@ ref 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 vm(mapStaticEnvBindings(*expr.staticenv.get(), env)); - runRepl(evalState, error, expr, *vm); + runRepl(evalState, expr, *vm); } }; } diff --git a/src/libcmd/command.hh b/src/libcmd/command.hh index 94ad80210..9247d401e 100644 --- a/src/libcmd/command.hh +++ b/src/libcmd/command.hh @@ -274,7 +274,6 @@ void printClosureDiff( void runRepl( ref evalState, - const Error *debugError, const Expr &expr, const std::map & extraEnv); } diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index 2e7974b5d..22a6439b4 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -50,7 +50,6 @@ struct NixRepl ref 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, - const Error *debugError, const Expr &expr, const std::map & extraEnv) { auto repl = std::make_unique(evalState); - repl->debugError = debugError; - repl->initEnv(); // add 'extra' vars. - // std::set 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({}); }