about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-04-01T14·35+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-04-01T14·35+0000
commitc172274e170a87a30420842ee07ed1f7226d7f2e (patch)
tree1661cd1b8f3ed0f414c820dccc61998e4b7a8c36
parent7b851915bfbad1c561191a037a2924d2b3d2d398 (diff)
* Quick hack to make coerceToString work more or less correctly on
  nested lists.  `nix-instantiate' can now evaluate the NixOS system
  derivation attribute correctly (in 2.1s on my laptop vs. 6.2s for
  the trunk).

-rw-r--r--src/libexpr/eval.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 49aeb0036863..8c8bb219bdb5 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -804,9 +804,12 @@ string EvalState::coerceToString(Value & v, PathSet & context,
         if (v.type == tList) {
             string result;
             for (unsigned int n = 0; n < v.list.length; ++n) {
-                if (n) result += " ";
                 result += coerceToString(v.list.elems[n],
                     context, coerceMore, copyToStore);
+                if (n < v.list.length - 1
+                    /* !!! not quite correct */
+                    && (v.list.elems[n].type != tList || v.list.elems[n].list.length != 0))
+                    result += " ";
             }
             return result;
         }