forked from lix-project/lix
Properly take the last assignment in the REPL
When a variable is assigned in the REPL, make sure to remove any possible reference to the old one so that we correctly pick the new one afterwards Fix #5706
This commit is contained in:
parent
bc57b3854e
commit
55e3a1108c
|
@ -672,6 +672,8 @@ void NixRepl::addVarToScope(const Symbol & name, Value & v)
|
|||
{
|
||||
if (displ >= envSize)
|
||||
throw Error("environment full; cannot add more variables");
|
||||
if (auto oldVar = staticEnv.find(name); oldVar != staticEnv.vars.end())
|
||||
staticEnv.vars.erase(oldVar);
|
||||
staticEnv.vars.emplace_back(name, displ);
|
||||
staticEnv.sort();
|
||||
env->values[displ++] = &v;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
source common.sh
|
||||
|
||||
replCmds="
|
||||
simple = 1
|
||||
simple = import ./simple.nix
|
||||
:b simple
|
||||
:log simple
|
||||
|
|
Loading…
Reference in a new issue