about summary refs log tree commit diff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 1ee6c5a7f6aa..eb1d8d432c69 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -59,6 +59,7 @@ std::ostream & operator << (std::ostream & str, const Value & v)
         str << "]";
         break;
     case tThunk:
+    case tApp:
     case tCopy:
         str << "<CODE>";
         break;
@@ -901,12 +902,18 @@ string EvalState::forceString(Value & v)
 }
 
 
-string EvalState::forceString(Value & v, PathSet & context)
+void copyContext(const Value & v, PathSet & context)
 {
-    string s = forceString(v);
     if (v.string.context)
         for (const char * * p = v.string.context; *p; ++p) 
             context.insert(*p);
+}
+
+
+string EvalState::forceString(Value & v, PathSet & context)
+{
+    string s = forceString(v);
+    copyContext(v, context);
     return s;
 }
 
@@ -937,9 +944,7 @@ string EvalState::coerceToString(Value & v, PathSet & context,
     string s;
 
     if (v.type == tString) {
-        if (v.string.context) 
-            for (const char * * p = v.string.context; *p; ++p) 
-                context.insert(*p);
+        copyContext(v, context);
         return v.string.s;
     }