about summary refs log tree commit diff
path: root/third_party/nix/src/nix/repl.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-22T00·58+0100
committerVincent Ambo <tazjin@google.com>2020-05-22T00·59+0100
commit986a8f6b75ffa51682cbe730c5c2907296082cd4 (patch)
tree32c266920223bbfbf0beb49689dc05cb8eb1f2b7 /third_party/nix/src/nix/repl.cc
parent42205f27fc820ddc64616d55c04e2ffde1948043 (diff)
fix(3p/nix): Update for usage of new attribute set API r/802
The new attribute set API uses the iterators of the btree_map
directly. This requires changes in various files because the internals
of libexpr are very entangled.

This code runs and compiles, but there is a bug causing empty
attribute sets to be assigned incorrectly.
Diffstat (limited to 'third_party/nix/src/nix/repl.cc')
-rw-r--r--third_party/nix/src/nix/repl.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/third_party/nix/src/nix/repl.cc b/third_party/nix/src/nix/repl.cc
index e60ef89652..87caf9dd3f 100644
--- a/third_party/nix/src/nix/repl.cc
+++ b/third_party/nix/src/nix/repl.cc
@@ -385,7 +385,7 @@ StringSet NixRepl::completePrefix(const string& prefix) {
       state.forceAttrs(v);
 
       for (auto& i : *v.attrs) {
-        string name = i.name;
+        string name = i.second.name;
         if (string(name, 0, cur2.size()) != cur2) {
           continue;
         }
@@ -627,7 +627,7 @@ void NixRepl::reloadFiles() {
 void NixRepl::addAttrsToScope(Value& attrs) {
   state.forceAttrs(attrs);
   for (auto& i : *attrs.attrs) {
-    addVarToScope(i.name, *i.value);
+    addVarToScope(i.second.name, *i.second.value);
   }
   std::cout << format("Added %1% variables.") % attrs.attrs->size()
             << std::endl;
@@ -718,9 +718,10 @@ std::ostream& NixRepl::printValue(std::ostream& str, Value& v,
         str << "«derivation ";
         Bindings::iterator i = v.attrs->find(state.sDrvPath);
         PathSet context;
-        Path drvPath = i != v.attrs->end()
-                           ? state.coerceToPath(*i->pos, *i->value, context)
-                           : "???";
+        Path drvPath =
+            i != v.attrs->end()
+                ? state.coerceToPath(*i->second.pos, *i->second.value, context)
+                : "???";
         str << drvPath << "»";
       }
 
@@ -730,7 +731,7 @@ std::ostream& NixRepl::printValue(std::ostream& str, Value& v,
         typedef std::map<string, Value*> Sorted;
         Sorted sorted;
         for (auto& i : *v.attrs) {
-          sorted[i.name] = i.value;
+          sorted[i.second.name] = i.second.value;
         }
 
         for (auto& i : sorted) {