libcmd/repl.cc: Explain evalString call and defend

This commit is contained in:
Robert Hensing 2024-07-15 19:23:23 +02:00
parent 21817473e8
commit ac89df815d

View file

@ -632,8 +632,13 @@ ProcessLineResult NixRepl::processLine(std::string line)
assert(attrs);
auto attr = attrs->get(name);
if (!attr) {
// Trigger the normal error
// When missing, trigger the normal exception
// e.g. :doc builtins.foo
// behaves like
// nix-repl> builtins.foo
// error: attribute 'foo' missing
evalString(arg, v);
assert(false);
}
if (attr->pos) {
fallbackPos = attr->pos;