mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-27 08:16:14 +02:00
don't add builtins to extras, initEnv() in regular repl
This commit is contained in:
parent
d0d5890445
commit
ff82ba98b4
2 changed files with 4 additions and 19 deletions
|
@ -901,8 +901,8 @@ void runRepl(
|
||||||
|
|
||||||
repl->initEnv();
|
repl->initEnv();
|
||||||
|
|
||||||
|
// add 'extra' vars.
|
||||||
std::set<std::string> names;
|
std::set<std::string> names;
|
||||||
|
|
||||||
for (auto & [name, value] : extraEnv) {
|
for (auto & [name, value] : extraEnv) {
|
||||||
// names.insert(ANSI_BOLD + name + ANSI_NORMAL);
|
// names.insert(ANSI_BOLD + name + ANSI_NORMAL);
|
||||||
names.insert(name);
|
names.insert(name);
|
||||||
|
@ -951,6 +951,7 @@ struct CmdRepl : StoreCommand, MixEvalArgs
|
||||||
|
|
||||||
auto repl = std::make_unique<NixRepl>(evalState);
|
auto repl = std::make_unique<NixRepl>(evalState);
|
||||||
repl->autoArgs = getAutoArgs(*repl->state);
|
repl->autoArgs = getAutoArgs(*repl->state);
|
||||||
|
repl->initEnv();
|
||||||
repl->mainLoop(files);
|
repl->mainLoop(files);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -715,8 +715,9 @@ 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.
|
// override the higher levels.
|
||||||
|
// The top level bindings (builtins) are skipped since they are added for us by initEnv()
|
||||||
if (env.up && se.up) {
|
if (env.up && se.up) {
|
||||||
mapStaticEnvBindings( *se.up, *env.up,vm);
|
mapStaticEnvBindings(*se.up, *env.up,vm);
|
||||||
|
|
||||||
// iterate through staticenv bindings and add them.
|
// iterate through staticenv bindings and add them.
|
||||||
auto map = valmap();
|
auto map = valmap();
|
||||||
|
@ -725,23 +726,6 @@ void mapStaticEnvBindings(const StaticEnv &se, const Env &env, valmap & vm)
|
||||||
map[iter->first] = env.values[iter->second];
|
map[iter->first] = env.values[iter->second];
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.merge(map);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue