From 1b6b33d43d5fa4675848b39121f681ae330b2b86 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 3 Jan 2022 18:29:43 -0700 Subject: [PATCH] filter out underscore names --- src/libexpr/eval.cc | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 851058b3e..86561c6b0 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -680,16 +680,28 @@ void printStaticEnvBindings(const StaticEnv &se, int lvl) { std::cout << "Env level " << lvl << std::endl; - for (auto i = se.vars.begin(); i != se.vars.end(); ++i) - { - std::cout << i->first << " "; - } - std::cout << std::endl; - std::cout << std::endl; - if (se.up) { + for (auto i = se.vars.begin(); i != se.vars.end(); ++i) + { + std::cout << i->first << " "; + } + std::cout << std::endl; + std::cout << std::endl; + printStaticEnvBindings(*se.up, ++lvl); } + else + { + // for the top level, don't print the double underscore ones; they are in builtins. + for (auto i = se.vars.begin(); i != se.vars.end(); ++i) + { + if (((string)i->first).substr(0,2) != "__") + std::cout << i->first << " "; + } + std::cout << std::endl; + std::cout << std::endl; + + } }