diff options
Diffstat (limited to 'src/libcmd/repl.cc')
-rw-r--r-- | src/libcmd/repl.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index 24ab8acb9..99abbe44b 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -155,7 +155,7 @@ struct NixRepl void reloadFiles(); void addAttrsToScope(Value & attrs); void addVarToScope(const Symbol name, Value & v); - Expr * parseString(std::string s); + Expr & parseString(std::string s); void evalString(std::string s, Value & v); void loadDebugTraceEnv(DebugTrace & dt); @@ -428,9 +428,9 @@ StringSet NixRepl::completePrefix(const std::string & prefix) auto expr = cur.substr(0, dot); auto cur2 = cur.substr(dot + 1); - Expr * e = parseString(expr); + Expr & e = parseString(expr); Value v; - e->eval(*state, *env, v); + e.eval(*state, *env, v); state->forceAttrs(v, noPos, "while evaluating an attrset for the purpose of completion (this error should not be displayed; file an issue?)"); for (auto & i : *v.attrs) { @@ -821,7 +821,7 @@ ProcessLineResult NixRepl::processLine(std::string line) line[p + 1] != '=' && isVarName(name = removeWhitespace(line.substr(0, p)))) { - Expr * e = parseString(line.substr(p + 1)); + Expr & e = parseString(line.substr(p + 1)); Value & v(*state->allocValue()); v.mkThunk(env, e); addVarToScope(state->symbols.create(name), v); @@ -946,7 +946,7 @@ Value * NixRepl::getReplOverlaysEvalFunction() auto code = #include "repl-overlays.nix.gen.hh" ; - auto expr = state->parseExprFromString( + auto & expr = state->parseExprFromString( code, SourcePath(evalReplInitFilesPath), state->staticBaseEnv @@ -1054,7 +1054,7 @@ Value * NixRepl::bindingsToAttrs() } -Expr * NixRepl::parseString(std::string s) +Expr & NixRepl::parseString(std::string s) { return state->parseExprFromString(std::move(s), state->rootPath(CanonPath::fromCwd()), staticEnv); } @@ -1062,16 +1062,16 @@ Expr * NixRepl::parseString(std::string s) void NixRepl::evalString(std::string s, Value & v) { - Expr * e = parseString(s); - e->eval(*state, *env, v); + Expr & e = parseString(s); + e.eval(*state, *env, v); state->forceValue(v, v.determinePos(noPos)); } Value * NixRepl::evalFile(SourcePath & path) { - auto expr = state->parseExprFromFile(path, staticEnv); + auto & expr = state->parseExprFromFile(path, staticEnv); Value * result(state->allocValue()); - expr->eval(*state, *env, *result); + expr.eval(*state, *env, *result); state->forceValue(*result, result->determinePos(noPos)); return result; } |