diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-05-05 12:29:14 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-05-05 17:17:03 +0200 |
commit | dd8b91eebc0d31c9f8016609b36d89f58d8c4d19 (patch) | |
tree | 485741fbee955ba1e7137c6a6e627d003e5964d7 /src/libcmd/command.cc | |
parent | c98648bef06fa749da156f11c61c97a8b066b271 (diff) |
Style fixes
In particular, use std::make_shared and enumerate(). Also renamed some
fields to fit naming conventions.
Diffstat (limited to 'src/libcmd/command.cc')
-rw-r--r-- | src/libcmd/command.cc | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 56d529461..12cd5ed83 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -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); } }; |