diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-22T00·58+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-22T00·59+0100 |
commit | 986a8f6b75ffa51682cbe730c5c2907296082cd4 (patch) | |
tree | 32c266920223bbfbf0beb49689dc05cb8eb1f2b7 /third_party/nix/src/nix/search.cc | |
parent | 42205f27fc820ddc64616d55c04e2ffde1948043 (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/search.cc')
-rw-r--r-- | third_party/nix/src/nix/search.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/third_party/nix/src/nix/search.cc b/third_party/nix/src/nix/search.cc index 169daf7a32..97c5122d60 100644 --- a/third_party/nix/src/nix/search.cc +++ b/third_party/nix/src/nix/search.cc @@ -175,7 +175,8 @@ struct CmdSearch : SourceExprCommand, MixJSON { if (!toplevel) { auto attrs = v->attrs; Bindings::iterator j = attrs->find(sRecurse); - if (j == attrs->end() || !state->forceBool(*j->value, *j->pos)) { + if (j == attrs->end() || + !state->forceBool(*j->second.value, *j->second.pos)) { DLOG(INFO) << "skip attribute '" << attrPath << "'"; return; } @@ -184,18 +185,19 @@ struct CmdSearch : SourceExprCommand, MixJSON { bool toplevel2 = false; if (!fromCache) { Bindings::iterator j = v->attrs->find(sToplevel); - toplevel2 = - j != v->attrs->end() && state->forceBool(*j->value, *j->pos); + toplevel2 = j != v->attrs->end() && + state->forceBool(*j->second.value, *j->second.pos); } for (auto& i : *v->attrs) { auto cache2 = cache != nullptr - ? std::make_unique<JSONObject>(cache->object(i.name)) + ? std::make_unique<JSONObject>(cache->object(i.second.name)) : nullptr; - doExpr(i.value, - attrPath.empty() ? (std::string)i.name - : attrPath + "." + (std::string)i.name, + doExpr(i.second.value, + attrPath.empty() + ? (std::string)i.second.name + : attrPath + "." + (std::string)i.second.name, toplevel2 || fromCache, cache2 ? cache2.get() : nullptr); } } |