From c6691089814ac16eb02bab968a97ea2b0fe942f2 Mon Sep 17 00:00:00 2001 From: Ben Burdette Date: Mon, 3 Jan 2022 18:13:16 -0700 Subject: [PATCH] merge cleanup --- src/libcmd/command.cc | 20 +++++++------------- src/libcmd/repl.cc | 8 ++++---- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index b254a90f0..252bc1fad 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -68,7 +68,13 @@ extern std::function EvalCommand::getEvalState() { if (!evalState) { - evalState = std::make_shared(searchPath, getEvalStore(), getStore()); + evalState = +#if HAVE_BOEHMGC + std::allocate_shared(traceable_allocator(), +#else + std::make_shared( +#endif + searchPath, getEvalStore(), getStore()); if (startReplOnEvalErrors) debuggerHook = [evalState{ref(evalState)}](const Error & error, const Env & env, const Expr & expr) { printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error.what()); @@ -96,18 +102,6 @@ ref EvalCommand::getEvalStore() return ref(evalStore); } -ref EvalCommand::getEvalState() -{ - if (!evalState) evalState = -#if HAVE_BOEHMGC - std::allocate_shared(traceable_allocator(), -#else - std::make_shared( -#endif - searchPath, getEvalStore(), getStore()); - return ref(evalState); -} - BuiltPathsCommand::BuiltPathsCommand(bool recursive) : recursive(recursive) { diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index e7628082a..4cf93c26e 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -435,7 +435,7 @@ bool NixRepl::processLine(string line) << " :u Build derivation, then start nix-shell\n" << " :doc Show documentation of a builtin function\n" << " :log Show logs for a derivation\n" - << " :st [bool] Enable, disable or toggle showing traces for errors\n"; + << " :st [bool] Enable, disable or toggle showing traces for errors\n" << " :d Debug mode commands\n" << " :d stack Show call stack\n" << " :d env Show env stack\n" @@ -730,12 +730,12 @@ void NixRepl::addAttrsToScope(Value & attrs) throw Error("environment full; cannot add more variables"); for (auto & i : *attrs.attrs) { - staticEnv.vars.emplace_back(i.name, displ); + staticEnv->vars.emplace_back(i.name, displ); env->values[displ++] = i.value; varNames.insert((string) i.name); } - staticEnv.sort(); - staticEnv.deduplicate(); + staticEnv->sort(); + staticEnv->deduplicate(); notice("Added %1% variables.", attrs.attrs->size()); }