mirror of
https://github.com/NixOS/nix.git
synced 2025-11-21 01:39:36 +01:00
fix: wait on incomplete assignment in REPL
Fixes: https://github.com/NixOS/nix/issues/13507
This commit is contained in:
parent
7817239644
commit
0a3eb22360
1 changed files with 6 additions and 7 deletions
|
|
@ -869,14 +869,8 @@ void NixRepl::addVarToScope(const Symbol name, Value & v)
|
||||||
|
|
||||||
Expr * NixRepl::parseString(std::string s)
|
Expr * NixRepl::parseString(std::string s)
|
||||||
{
|
{
|
||||||
return state->parseExprFromString(std::move(s), state->rootPath("."), staticEnv);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NixRepl::evalString(std::string s, Value & v)
|
|
||||||
{
|
|
||||||
Expr * e;
|
|
||||||
try {
|
try {
|
||||||
e = parseString(s);
|
return state->parseExprFromString(std::move(s), state->rootPath("."), staticEnv);
|
||||||
} catch (ParseError & e) {
|
} catch (ParseError & e) {
|
||||||
if (e.msg().find("unexpected end of file") != std::string::npos)
|
if (e.msg().find("unexpected end of file") != std::string::npos)
|
||||||
// For parse errors on incomplete input, we continue waiting for the next line of
|
// For parse errors on incomplete input, we continue waiting for the next line of
|
||||||
|
|
@ -885,6 +879,11 @@ void NixRepl::evalString(std::string s, Value & v)
|
||||||
else
|
else
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NixRepl::evalString(std::string s, Value & v)
|
||||||
|
{
|
||||||
|
Expr * e = parseString(s);
|
||||||
e->eval(*state, *env, v);
|
e->eval(*state, *env, v);
|
||||||
state->forceValue(v, v.determinePos(noPos));
|
state->forceValue(v, v.determinePos(noPos));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue