From 4610e02d04c9f41ac355d2ca6a27d3a631ffefc6 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 27 Dec 2021 18:12:46 -0700 Subject: [PATCH] remove debug code --- src/libcmd/command.cc | 10 +++++----- src/libcmd/repl.cc | 18 ------------------ src/libexpr/eval.cc | 6 ------ src/libexpr/parser.y | 4 ---- src/libutil/error.cc | 2 -- 5 files changed, 5 insertions(+), 35 deletions(-) diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 897d81981..b97458b2d 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -73,13 +73,13 @@ ref EvalCommand::getEvalState() debuggerHook = [evalState{ref(evalState)}](const Error & error, const Env & env, const Expr & expr) { printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what()); - printStaticEnvBindings(expr); + // printStaticEnvBindings(expr); - std::cout << evalState->vCallFlake << std::endl; + // std::cout << evalState->vCallFlake << std::endl; - std::cout << "expr: " << std::endl; - expr.show(std::cout); - std::cout << std::endl; + // std::cout << "expr: " << std::endl; + // expr.show(std::cout); + // std::cout << std::endl; if (expr.staticenv) { diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index 4a61d2be4..64547344a 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -202,9 +202,6 @@ namespace { void NixRepl::mainLoop(const std::vector & files) { - std::cout << "iinitial mainLoop; " << std::endl; - // printStaticEnvBindings(*staticEnv, 0); - string error = ANSI_RED "error:" ANSI_NORMAL " "; notice("Welcome to Nix " + nixVersion + ". Type :? for help.\n"); @@ -231,9 +228,6 @@ void NixRepl::mainLoop(const std::vector & files) std::string input; - std::cout << "pre MAINLOOP; " << std::endl; - // printStaticEnvBindings(*staticEnv, 0); - while (true) { // When continuing input from previous lines, don't print a prompt, just align to the same // number of chars as the prompt. @@ -446,7 +440,6 @@ bool NixRepl::processLine(string line) } else if (command == ":d" || command == ":debug") { - std::cout << "debug: '" << arg << "'" << std::endl; if (arg == "stack") { std::cout << "eval stack:" << std::endl; for (auto iter = this->state->debugTraces.begin(); @@ -613,13 +606,11 @@ bool NixRepl::processLine(string line) line[p + 1] != '=' && isVarName(name = removeWhitespace(string(line, 0, p)))) { - std::cout << "isvarname" << std::endl; Expr * e = parseString(string(line, p + 1)); Value *v = new Value(*state->allocValue()); v->mkThunk(env, e); addVarToScope(state->symbols.create(name), *v); } else { - std::cout << "evalstring" << std::endl; Value v; evalString(line, v); printValue(std::cout, v, 1) << std::endl; @@ -715,8 +706,6 @@ void NixRepl::addVarToScope(const Symbol & name, Value & v) staticEnv->sort(); env->values[displ++] = &v; varNames.insert((string) name); - notice("Added variable to scope: %1%", name); - } // version from master. @@ -741,11 +730,8 @@ Expr * NixRepl::parseString(string s) void NixRepl::evalString(string s, Value & v) { - std::cout << "pre partstirns:l" << std::endl; Expr * e = parseString(s); - std::cout << "pre e->eval" << std::endl; e->eval(*state, *env, v); - std::cout << "prev fv" << std::endl; state->forceValue(v); } @@ -924,10 +910,6 @@ void runRepl( } printError(hintfmt("The following extra variables are in scope: %s\n", concatStringsSep(", ", names)).str()); - // printError("The following extra variables are in scope: %s\n", concatStringsSep(", ", names)); - - std::cout << " pre repl->mainLoop({});" << std::endl; - // printStaticEnvBindings(*repl->staticEnv, 0); repl->mainLoop({}); } diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 4bdcc052f..2596fbe3a 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -858,17 +858,12 @@ LocalNoInlineNoReturn(void throwAssertionError(const Pos & pos, const char * s, LocalNoInlineNoReturn(void throwUndefinedVarError(const Pos & pos, const char * s, const string & s1, Env & env, Expr *expr)) { - std::cout << "throwUndefinedVarError" << std::endl; - - std::cout << "loggerSettings.showTrace: " << loggerSettings.showTrace << std::endl; - auto error = UndefinedVarError({ .msg = hintfmt(s, s1), .errPos = pos }); if (debuggerHook && expr) { - std::cout << "throwUndefinedVarError debuggerHook" << std::endl; debuggerHook(error, env, *expr); } @@ -1525,7 +1520,6 @@ void EvalState::callFunction(Value & fun, size_t nrArgs, Value * * args, Value & lambda.body->eval(*this, env2, vCur); } catch (Error & e) { - std::cout << "eval showErrorInfo showTrace: " << loggerSettings.showTrace.get() << std::endl; if (loggerSettings.showTrace.get()) { addErrorTrace(e, lambda.pos, "while evaluating %s", (lambda.name.set() diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index 066dc4ecc..c537aa0c2 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -616,10 +616,6 @@ Expr * EvalState::parse(const char * text, FileOrigin origin, if (res) throw ParseError(data.error.value()); - std::cout << " data.result->bindVars(staticEnv); " << std::endl; - - // printStaticEnvBindings(*staticEnv, 0); - data.result->bindVars(staticEnv); return data.result; diff --git a/src/libutil/error.cc b/src/libutil/error.cc index c2b9d2707..203d79087 100644 --- a/src/libutil/error.cc +++ b/src/libutil/error.cc @@ -221,8 +221,6 @@ static std::string indent(std::string_view indentFirst, std::string_view indentR std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool showTrace) { - std::cout << "showErrorInfo showTrace: " << showTrace << std::endl; - std::string prefix; switch (einfo.level) { case Verbosity::lvlError: {