From 172a83d22a3c984b6b569b5528d2338059bb748b Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Fri, 29 Apr 2022 11:24:54 -0600 Subject: [PATCH] line endings --- src/libcmd/command.cc | 2 +- src/libcmd/repl.cc | 10 +++++----- src/libexpr/eval.cc | 12 ++++++------ src/libexpr/nixexpr.cc | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 3e789adba..56d529461 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -125,7 +125,7 @@ ref EvalCommand::getEvalState() std::unique_ptr( new DebugTraceStacker( *evalState, - DebugTrace + DebugTrace {.pos = (error->info().errPos ? *error->info().errPos : evalState->positions[expr.getPos()]), .expr = expr, .env = env, diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index 40299e910..b94831064 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -276,10 +276,10 @@ void NixRepl::mainLoop(const std::vector & files) printMsg(lvlError, e.msg()); } } catch (EvalError & e) { - // in debugger mode, an EvalError should trigger another repl session. + // in debugger mode, an EvalError should trigger another repl session. // when that session returns the exception will land here. No need to show it again; // show the error for this repl session instead. - if (debuggerHook && !this->state->debugTraces.empty()) + if (debuggerHook && !this->state->debugTraces.empty()) showDebugTrace(std::cout, this->state->positions, this->state->debugTraces.front()); else printMsg(lvlError, e.msg()); @@ -511,7 +511,7 @@ bool NixRepl::processLine(std::string line) if (arg == "stack") { int idx = 0; for (auto iter = this->state->debugTraces.begin(); - iter != this->state->debugTraces.end(); + iter != this->state->debugTraces.end(); ++iter, ++idx) { std::cout << "\n" << ANSI_BLUE << idx << ANSI_NORMAL << ": "; showDebugTrace(std::cout, this->state->positions, *iter); @@ -519,7 +519,7 @@ bool NixRepl::processLine(std::string line) } else if (arg == "env") { int idx = 0; for (auto iter = this->state->debugTraces.begin(); - iter != this->state->debugTraces.end(); + iter != this->state->debugTraces.end(); ++iter, ++idx) { if (idx == this->debugTraceIndex) { @@ -539,7 +539,7 @@ bool NixRepl::processLine(std::string line) int idx = 0; for (auto iter = this->state->debugTraces.begin(); - iter != this->state->debugTraces.end(); + iter != this->state->debugTraces.end(); ++iter, ++idx) { if (idx == this->debugTraceIndex) { diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 294168392..10dba69e7 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -730,7 +730,7 @@ void printWithBindings(const SymbolTable &st, const Env &env) { if (env.type == Env::HasWithAttrs) { - std::cout << "with: "; + std::cout << "with: "; std::cout << ANSI_MAGENTA; Bindings::iterator j = env.values[0]->attrs->begin(); while (j != env.values[0]->attrs->end()) { @@ -747,13 +747,13 @@ void printEnvBindings(const SymbolTable &st, const StaticEnv &se, const Env &env std::cout << "Env level " << lvl << std::endl; if (se.up && env.up) { - std::cout << "static: "; + std::cout << "static: "; printStaticEnvBindings(st, se); printWithBindings(st, env); std::cout << std::endl; printEnvBindings(st, *se.up, *env.up, ++lvl); } - else + else { std::cout << ANSI_MAGENTA; // for the top level, don't print the double underscore ones; they are in builtins. @@ -784,7 +784,7 @@ void mapStaticEnvBindings(const SymbolTable &st, const StaticEnv &se, const Env { // add bindings for the next level up first, so that the bindings for this level // override the higher levels. - // The top level bindings (builtins) are skipped since they are added for us by initEnv() + // The top level bindings (builtins) are skipped since they are added for us by initEnv() if (env.up && se.up) { mapStaticEnvBindings(st, *se.up, *env.up, vm); @@ -1086,13 +1086,13 @@ void EvalState::addErrorTrace(Error & e, const PosIdx pos, const char * s, const e.addTrace(positions[pos], s, s2); } -std::unique_ptr makeDebugTraceStacker(EvalState &state, Expr &expr, Env &env, +std::unique_ptr makeDebugTraceStacker(EvalState &state, Expr &expr, Env &env, std::optional pos, const char * s, const std::string & s2) { return std::unique_ptr( new DebugTraceStacker( state, - DebugTrace + DebugTrace {.pos = pos, .expr = expr, .env = env, diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index c6e545729..5624c4780 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -352,7 +352,7 @@ void ExprVar::bindVars(const EvalState & es, const std::shared_ptr(new StaticEnv(false, env.get(), recursive ? attrs.size() : 0)); + auto newEnv = std::shared_ptr(new StaticEnv(false, env.get(), recursive ? attrs.size() : 0)); Displacement displ = 0; for (auto & i : attrs)