mirror of
https://github.com/NixOS/nix
synced 2025-06-28 17:51:15 +02:00
use an expr->StaticEnv table in evalState
This commit is contained in:
parent
86ba0a702c
commit
357fb84dba
6 changed files with 68 additions and 56 deletions
|
@ -136,8 +136,9 @@ ref<EvalState> EvalCommand::getEvalState()
|
|||
if (error)
|
||||
printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error->what());
|
||||
|
||||
if (expr.staticEnv) {
|
||||
auto vm = mapStaticEnvBindings(evalState->symbols, *expr.staticEnv.get(), env);
|
||||
auto se = evalState->getStaticEnv(expr);
|
||||
if (se) {
|
||||
auto vm = mapStaticEnvBindings(evalState->symbols, *se.get(), env);
|
||||
runRepl(evalState, *vm);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -441,8 +441,9 @@ void NixRepl::loadDebugTraceEnv(DebugTrace & dt)
|
|||
{
|
||||
initEnv();
|
||||
|
||||
if (dt.expr.staticEnv) {
|
||||
auto vm = mapStaticEnvBindings(state->symbols, *dt.expr.staticEnv.get(), dt.env);
|
||||
auto se = state->getStaticEnv(dt.expr);
|
||||
if (se) {
|
||||
auto vm = mapStaticEnvBindings(state->symbols, *se.get(), dt.env);
|
||||
|
||||
// add staticenv vars.
|
||||
for (auto & [name, value] : *(vm.get()))
|
||||
|
@ -516,7 +517,7 @@ bool NixRepl::processLine(std::string line)
|
|||
else if (debuggerHook && (command == ":env")) {
|
||||
for (const auto & [idx, i] : enumerate(state->debugTraces)) {
|
||||
if (idx == debugTraceIndex) {
|
||||
printEnvBindings(state->symbols, i.expr, i.env);
|
||||
printEnvBindings(*state, i.expr, i.env);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -533,7 +534,7 @@ bool NixRepl::processLine(std::string line)
|
|||
std::cout << "\n" << ANSI_BLUE << idx << ANSI_NORMAL << ": ";
|
||||
showDebugTrace(std::cout, state->positions, i);
|
||||
std::cout << std::endl;
|
||||
printEnvBindings(state->symbols, i.expr, i.env);
|
||||
printEnvBindings(*state, i.expr, i.env);
|
||||
loadDebugTraceEnv(i);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue