aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-05-12 12:15:49 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-05-12 12:15:49 +0000
commitbd25ac2260267abd2181324e1650820da70e5e60 (patch)
tree954b2ecdce037dcf47b0376616ac05dbad8542ab /src/libexpr
parent81a4b4e49bf82f17eef20d78c4f505874cf5532e (diff)
* Print attributes in sorted order.
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/eval.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 69632eb37..26739faf6 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -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)