1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-20 23:28:26 -04:00

remove debug code

This commit is contained in:
Ben Burdette 2021-12-27 18:12:46 -07:00
parent 9760fa8661
commit 4610e02d04
5 changed files with 5 additions and 35 deletions

View file

@ -73,13 +73,13 @@ ref<EvalState> EvalCommand::getEvalState()
debuggerHook = [evalState{ref<EvalState>(evalState)}](const Error & error, const Env & env, const Expr & expr) { debuggerHook = [evalState{ref<EvalState>(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()); 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; // std::cout << "expr: " << std::endl;
expr.show(std::cout); // expr.show(std::cout);
std::cout << std::endl; // std::cout << std::endl;
if (expr.staticenv) if (expr.staticenv)
{ {

View file

@ -202,9 +202,6 @@ namespace {
void NixRepl::mainLoop(const std::vector<std::string> & files) void NixRepl::mainLoop(const std::vector<std::string> & files)
{ {
std::cout << "iinitial mainLoop; " << std::endl;
// printStaticEnvBindings(*staticEnv, 0);
string error = ANSI_RED "error:" ANSI_NORMAL " "; string error = ANSI_RED "error:" ANSI_NORMAL " ";
notice("Welcome to Nix " + nixVersion + ". Type :? for help.\n"); notice("Welcome to Nix " + nixVersion + ". Type :? for help.\n");
@ -231,9 +228,6 @@ void NixRepl::mainLoop(const std::vector<std::string> & files)
std::string input; std::string input;
std::cout << "pre MAINLOOP; " << std::endl;
// printStaticEnvBindings(*staticEnv, 0);
while (true) { while (true) {
// When continuing input from previous lines, don't print a prompt, just align to the same // When continuing input from previous lines, don't print a prompt, just align to the same
// number of chars as the prompt. // number of chars as the prompt.
@ -446,7 +440,6 @@ bool NixRepl::processLine(string line)
} }
else if (command == ":d" || command == ":debug") { else if (command == ":d" || command == ":debug") {
std::cout << "debug: '" << arg << "'" << std::endl;
if (arg == "stack") { if (arg == "stack") {
std::cout << "eval stack:" << std::endl; std::cout << "eval stack:" << std::endl;
for (auto iter = this->state->debugTraces.begin(); for (auto iter = this->state->debugTraces.begin();
@ -613,13 +606,11 @@ bool NixRepl::processLine(string line)
line[p + 1] != '=' && line[p + 1] != '=' &&
isVarName(name = removeWhitespace(string(line, 0, p)))) isVarName(name = removeWhitespace(string(line, 0, p))))
{ {
std::cout << "isvarname" << std::endl;
Expr * e = parseString(string(line, p + 1)); Expr * e = parseString(string(line, p + 1));
Value *v = new Value(*state->allocValue()); Value *v = new Value(*state->allocValue());
v->mkThunk(env, e); v->mkThunk(env, e);
addVarToScope(state->symbols.create(name), *v); addVarToScope(state->symbols.create(name), *v);
} else { } else {
std::cout << "evalstring" << std::endl;
Value v; Value v;
evalString(line, v); evalString(line, v);
printValue(std::cout, v, 1) << std::endl; printValue(std::cout, v, 1) << std::endl;
@ -715,8 +706,6 @@ void NixRepl::addVarToScope(const Symbol & name, Value & v)
staticEnv->sort(); staticEnv->sort();
env->values[displ++] = &v; env->values[displ++] = &v;
varNames.insert((string) name); varNames.insert((string) name);
notice("Added variable to scope: %1%", name);
} }
// version from master. // version from master.
@ -741,11 +730,8 @@ Expr * NixRepl::parseString(string s)
void NixRepl::evalString(string s, Value & v) void NixRepl::evalString(string s, Value & v)
{ {
std::cout << "pre partstirns:l" << std::endl;
Expr * e = parseString(s); Expr * e = parseString(s);
std::cout << "pre e->eval" << std::endl;
e->eval(*state, *env, v); e->eval(*state, *env, v);
std::cout << "prev fv" << std::endl;
state->forceValue(v); state->forceValue(v);
} }
@ -924,10 +910,6 @@ void runRepl(
} }
printError(hintfmt("The following extra variables are in scope: %s\n", concatStringsSep(", ", names)).str()); 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({}); repl->mainLoop({});
} }

View file

@ -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)) 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({ auto error = UndefinedVarError({
.msg = hintfmt(s, s1), .msg = hintfmt(s, s1),
.errPos = pos .errPos = pos
}); });
if (debuggerHook && expr) { if (debuggerHook && expr) {
std::cout << "throwUndefinedVarError debuggerHook" << std::endl;
debuggerHook(error, env, *expr); 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); lambda.body->eval(*this, env2, vCur);
} catch (Error & e) { } catch (Error & e) {
std::cout << "eval showErrorInfo showTrace: " << loggerSettings.showTrace.get() << std::endl;
if (loggerSettings.showTrace.get()) { if (loggerSettings.showTrace.get()) {
addErrorTrace(e, lambda.pos, "while evaluating %s", addErrorTrace(e, lambda.pos, "while evaluating %s",
(lambda.name.set() (lambda.name.set()

View file

@ -616,10 +616,6 @@ Expr * EvalState::parse(const char * text, FileOrigin origin,
if (res) throw ParseError(data.error.value()); if (res) throw ParseError(data.error.value());
std::cout << " data.result->bindVars(staticEnv); " << std::endl;
// printStaticEnvBindings(*staticEnv, 0);
data.result->bindVars(staticEnv); data.result->bindVars(staticEnv);
return data.result; return data.result;

View file

@ -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::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool showTrace)
{ {
std::cout << "showErrorInfo showTrace: " << showTrace << std::endl;
std::string prefix; std::string prefix;
switch (einfo.level) { switch (einfo.level) {
case Verbosity::lvlError: { case Verbosity::lvlError: {