From 69e26c5c4ba106bd16f60bfaac88ccf888b4383f Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Thu, 25 Nov 2021 08:23:07 -0700 Subject: [PATCH] more cleanup --- src/libcmd/command.cc | 4 ++-- src/libexpr/eval.cc | 23 +++++++++++------------ src/libexpr/nixexpr.cc | 1 - 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 8a6dd71b2..2c62bfa7f 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -81,8 +81,8 @@ ref EvalCommand::getEvalState() if (expr.staticenv) { - auto vm = mapStaticEnvBindings(*expr.staticenv.get(), env); - runRepl(evalState, *vm); + auto vm = mapStaticEnvBindings(*expr.staticenv.get(), env); + runRepl(evalState, *vm); } }; } diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 8e263334a..11a61da26 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -620,7 +620,7 @@ std::optional EvalState::getDoc(Value & v) void printStaticEnvBindings(const StaticEnv &se, int lvl) { - for (auto i = se.vars.begin(); i != se.vars.end(); ++i) + for (auto i = se.vars.begin(); i != se.vars.end(); ++i) { std::cout << lvl << i->first << std::endl; } @@ -628,22 +628,21 @@ void printStaticEnvBindings(const StaticEnv &se, int lvl) if (se.up) { printStaticEnvBindings(*se.up, ++lvl); } - + } void printStaticEnvBindings(const Expr &expr) { - // just print the names for now - if (expr.staticenv) - { - printStaticEnvBindings(*expr.staticenv.get(), 0); - } - + // just print the names for now + if (expr.staticenv) + { + printStaticEnvBindings(*expr.staticenv.get(), 0); + } } void mapStaticEnvBindings(const StaticEnv &se, const Env &env, valmap & vm) { - // add bindings for the next level up first, so that the bindings for this level + // add bindings for the next level up first, so that the bindings for this level // override the higher levels. if (env.up && se.up) { mapStaticEnvBindings( *se.up, *env.up,vm); @@ -651,13 +650,13 @@ void mapStaticEnvBindings(const StaticEnv &se, const Env &env, valmap & vm) // iterate through staticenv bindings and add them. auto map = valmap(); - for (auto iter = se.vars.begin(); iter != se.vars.end(); ++iter) + for (auto iter = se.vars.begin(); iter != se.vars.end(); ++iter) { - map[iter->first] = env.values[iter->second]; + map[iter->first] = env.values[iter->second]; } vm.merge(map); - + } diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 9ccecca55..3e42789a2 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -3,7 +3,6 @@ #include "util.hh" #include -#include namespace nix {