1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 11:41:15 +02:00

* Print attributes in sorted order.

This commit is contained in:
Eelco Dolstra 2010-05-12 12:15:49 +00:00
parent 81a4b4e49b
commit bd25ac2260
2 changed files with 8 additions and 3 deletions

View file

@ -41,12 +41,17 @@ std::ostream & operator << (std::ostream & str, Value & v)
case tNull:
str << "true";
break;
case tAttrs:
case tAttrs: {
str << "{ ";
typedef std::map<string, Value *> Sorted;
Sorted sorted;
foreach (Bindings::iterator, i, *v.attrs)
str << (string) i->first << " = " << i->second.value << "; ";
sorted[i->first] = &i->second.value;
foreach (Sorted::iterator, i, sorted)
str << i->first << " = " << *i->second << "; ";
str << "}";
break;
}
case tList:
str << "[ ";
for (unsigned int n = 0; n < v.list.length; ++n)