about summary refs log tree commit diff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-06-10T10·29+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-06-10T10·29+0000
commitf16fe2af8d59fef156c29077a240a832d3e60ef2 (patch)
treee76a9db974af45eb58015aa638f0ce170f2565e7 /src/libexpr/eval.cc
parent07ca66cf242eef3c7a6396e9353e48037034498b (diff)
* builtins.toXML: propagate the string context. This is a regression
  from the old ATerm-based evaluator.

Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index f95df5e4d6..eb1d8d432c 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -902,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;
 }
 
@@ -938,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;
     }