Author: eelco
Date: 2010-06-10 10:29:50 +0000 (Thu, 10 Jun 2010)
New Revision: 22206

You can view the changes in this commit at:
   https://svn.nixos.org/viewvc/nix?rev=22206&view=rev

Modified:
   nix/trunk/src/libexpr/eval.cc
   nix/trunk/src/libexpr/eval.hh
   nix/trunk/src/libexpr/value-to-xml.cc

Log:
* builtins.toXML: propagate the string context.  This is a regression
  from the old ATerm-based evaluator.


Changes:

Modified: nix/trunk/src/libexpr/eval.cc
===================================================================
--- nix/trunk/src/libexpr/eval.cc       2010-06-10 08:55:30 UTC (rev 22205)
+++ nix/trunk/src/libexpr/eval.cc       2010-06-10 10:29:50 UTC (rev 22206)
@@ -902,12 +902,18 @@
 }
 
 
-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 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;
     }
 

Modified: nix/trunk/src/libexpr/eval.hh
===================================================================
--- nix/trunk/src/libexpr/eval.hh       2010-06-10 08:55:30 UTC (rev 22205)
+++ nix/trunk/src/libexpr/eval.hh       2010-06-10 10:29:50 UTC (rev 22206)
@@ -161,7 +161,9 @@
 void mkString(Value & v, const string & s, const PathSet & context = 
PathSet());
 void mkPath(Value & v, const char * s);
 
+void copyContext(const Value & v, PathSet & context);
 
+
 typedef std::map<Path, Hash> DrvHashes;
 
 /* Cache for calls to addToStore(); maps source paths to the store

Modified: nix/trunk/src/libexpr/value-to-xml.cc
===================================================================
--- nix/trunk/src/libexpr/value-to-xml.cc       2010-06-10 08:55:30 UTC (rev 
22205)
+++ nix/trunk/src/libexpr/value-to-xml.cc       2010-06-10 10:29:50 UTC (rev 
22206)
@@ -69,6 +69,7 @@
 
         case tString:
             /* !!! show the context? */
+            copyContext(v, context);
             doc.writeEmptyElement("string", singletonAttrs("value", 
v.string.s));
             break;
 

_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to