1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 11:41:15 +02:00

print staticenv bindings

This commit is contained in:
Ben Burdette 2021-10-11 16:32:43 -06:00
parent 2ee1fa4afd
commit 98eb13691a
3 changed files with 39 additions and 3 deletions

View file

@ -712,6 +712,34 @@ void printStaticEnvBindings(const Expr &expr)
}
void mapStaticEnvBindings(const StaticEnv &se, const Env &env, valmap & vm)
{
// add bindings for the next level up first.
if (env.up && se.up) {
mapStaticEnvBindings( *se.up, *env.up,vm);
}
// iterate through staticenv bindings.
auto map = valmap();
for (auto iter = se.vars.begin(); iter != se.vars.end(); ++iter)
{
map[iter->first] = env.values[iter->second];
}
vm.merge(map);
}
valmap * mapStaticEnvBindings(const StaticEnv &se, const Env &env)
{
auto vm = new valmap();
mapStaticEnvBindings(se, env, *vm);
return vm;
}
void printEnvPosChain(const Env &env, int lv )
{
std::cout << "printEnvPosChain " << lv << std::endl;