1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-24 01:41:08 +01:00

Merge pull request #13508 from CertainLach/push-oyyysvytlnpr

fix: wait on incomplete assignment in REPL
This commit is contained in:
Sergei Zimmerman 2025-09-27 10:43:41 +00:00 committed by GitHub
commit b9571b6e52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -869,14 +869,8 @@ void NixRepl::addVarToScope(const Symbol name, Value & v)
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 {
e = parseString(s);
return state->parseExprFromString(std::move(s), state->rootPath("."), staticEnv);
} catch (ParseError & e) {
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
@ -885,6 +879,11 @@ void NixRepl::evalString(std::string s, Value & v)
else
throw;
}
}
void NixRepl::evalString(std::string s, Value & v)
{
Expr * e = parseString(s);
e->eval(*state, *env, v);
state->forceValue(v, v.determinePos(noPos));
}