From d0d589044512a77b345b7e576e2c45910c74eb02 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 27 Dec 2021 13:47:35 -0700 Subject: [PATCH] don't add underscore names to extras --- src/libexpr/eval.cc | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index b8d060276..377e1b2f8 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -716,18 +716,34 @@ 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 // override the higher levels. if (env.up && se.up) { - mapStaticEnvBindings( *se.up, *env.up,vm); - } + mapStaticEnvBindings( *se.up, *env.up,vm); - // iterate through staticenv bindings and add them. - auto map = valmap(); - for (auto iter = se.vars.begin(); iter != se.vars.end(); ++iter) + // iterate through staticenv bindings and add them. + auto map = valmap(); + for (auto iter = se.vars.begin(); iter != se.vars.end(); ++iter) + { + map[iter->first] = env.values[iter->second]; + } + + vm.merge(map); + } + else { - map[iter->first] = env.values[iter->second]; + std::cout << " -------------------- " << std::endl; + // iterate through staticenv bindings and add them, + // except for the __* ones. + auto map = valmap(); + for (auto iter = se.vars.begin(); iter != se.vars.end(); ++iter) + { + std::cout << iter->first << std::endl; + std::string s = iter->first; + if (s.substr(0,2) != "__") { + map[iter->first] = env.values[iter->second]; + } + } + + vm.merge(map); } - - vm.merge(map); - }