1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 08:31:16 +02:00

Style fixes

In particular, use std::make_shared and enumerate(). Also renamed some
fields to fit naming conventions.
This commit is contained in:
Eelco Dolstra 2022-05-05 12:29:14 +02:00
parent c98648bef0
commit dd8b91eebc
8 changed files with 247 additions and 305 deletions

View file

@ -121,25 +121,23 @@ ref<EvalState> EvalCommand::getEvalState()
if (startReplOnEvalErrors)
debuggerHook = [evalState{ref<EvalState>(evalState)}](const Error * error, const Env & env, const Expr & expr) {
auto dts =
error && expr.getPos() ?
std::unique_ptr<DebugTraceStacker>(
new DebugTraceStacker(
*evalState,
DebugTrace
{.pos = (error->info().errPos ? *error->info().errPos : evalState->positions[expr.getPos()]),
.expr = expr,
.env = env,
.hint = error->info().msg,
.is_error = true
}))
: nullptr;
error && expr.getPos()
? std::make_unique<DebugTraceStacker>(
*evalState,
DebugTrace {
.pos = error->info().errPos ? *error->info().errPos : evalState->positions[expr.getPos()],
.expr = expr,
.env = env,
.hint = error->info().msg,
.isError = true
})
: nullptr;
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)
{
std::unique_ptr<valmap> vm(mapStaticEnvBindings(evalState->symbols, *expr.staticenv.get(), env));
if (expr.staticEnv) {
auto vm = mapStaticEnvBindings(evalState->symbols, *expr.staticEnv.get(), env);
runRepl(evalState, expr, *vm);
}
};