diff options
author | Ben Burdette <bburdette@gmail.com> | 2021-08-25 11:19:09 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@gmail.com> | 2021-08-25 11:19:09 -0600 |
commit | d8a977a22ebd8884124a0a80e6b1523228f70f4b (patch) | |
tree | a8107d280c29931685cb0b67ef73693cf067d588 /src | |
parent | bd3b5329f91e6caff387cf361a5c779468f34f88 (diff) |
adding all the value names from env.values[0]
Diffstat (limited to 'src')
-rw-r--r-- | src/libcmd/command.cc | 2 | ||||
-rw-r--r-- | src/libexpr/eval.cc | 24 |
2 files changed, 12 insertions, 14 deletions
diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 1a59dff77..45665b555 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -103,7 +103,7 @@ extern std::function<void(const Error & error, const Env & env)> debuggerHook; ref<EvalState> EvalCommand::getEvalState() { - std::cout << " EvalCommand::getEvalState()" << startReplOnEvalErrors << std::endl; + std::cout << "EvalCommand::getEvalState()" << startReplOnEvalErrors << std::endl; if (!evalState) { evalState = std::make_shared<EvalState>(searchPath, getStore()); if (startReplOnEvalErrors) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 7fee1168c..6eb7f2cb9 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -698,21 +698,19 @@ void mapEnvBindings(const Env &env, valmap & vm) } // merge - and write over - higher level bindings. - if (env.valuemap) - vm.merge(*env.valuemap); + if (env.values[0]->type() == nAttrs) { + auto map = valmap(); + + Bindings::iterator j = env.values[0]->attrs->begin(); + + while (j != env.values[0]->attrs->end()) { + map[j->name] = j->value; + j++; + } + vm.merge(map); + } } -// void mapEnvBindings(const Env &env, valmap & vm) -// { -// // add bindings for the next level up first. -// if (env.up) { -// mapEnvBindings(*env.up, vm); -// } - -// // merge - and write over - higher level bindings. -// if (env.valuemap) -// vm.merge(*env.valuemap); -// } valmap * mapEnvBindings(const Env &env) { |