1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 17:51:15 +02:00

libexpr: Move identifier-like printing to print.cc

This commit is contained in:
Robert Hensing 2023-04-16 14:07:35 +02:00
parent 28a5cdde02
commit b6125772d7
4 changed files with 73 additions and 28 deletions

View file

@ -426,6 +426,7 @@ StringSet NixRepl::completePrefix(const std::string & prefix)
}
// FIXME: DRY and match or use the parser
static bool isVarName(std::string_view s)
{
if (s.size() == 0) return false;
@ -956,10 +957,7 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
sorted.emplace(state->symbols[i.name], i.value);
for (auto & i : sorted) {
if (isVarName(i.first))
str << i.first;
else
printLiteralString(str, i.first);
printAttributeName(str, i.first);
str << " = ";
if (seen.count(i.second))
str << "«repeated»";