1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 23:03:53 -04:00

showId: Handle empty attribute names

We should probably disallow these, but until then, we shouldn't barf
with an assertion failure.

Fixes #738.
This commit is contained in:
Eelco Dolstra 2015-12-17 15:15:28 +01:00
parent 338880ee6f
commit a9faa7bbce

View file

@ -30,8 +30,9 @@ static void showString(std::ostream & str, const string & s)
static void showId(std::ostream & str, const string & s) static void showId(std::ostream & str, const string & s)
{ {
assert(!s.empty()); if (s.empty())
if (s == "if") str << "\"\"";
else if (s == "if") // FIXME: handle other keywords
str << '"' << s << '"'; str << '"' << s << '"';
else { else {
char c = s[0]; char c = s[0];