refactor(tvix/libexpr): Remove Bindings::SortedByKeys()

Since we don't have a Bindings implementation with unstable order this
function is not required, as its callers can just iterate over the
attributes instead.

Change-Id: I01b35277b5a2dde69d684bc881dbd7c0701bcbb3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2291
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2020-12-22 21:51:50 +01:00 committed by tazjin
parent 0f9a7b3f86
commit f7ea650142
5 changed files with 46 additions and 64 deletions

View file

@ -389,26 +389,26 @@ static void getDerivations(EvalState& state, Value& vIn,
there are names clashes between derivations, the derivation
bound to the attribute with the "lower" name should take
precedence). */
for (auto& i : v.attrs->SortedByKeys()) {
DLOG(INFO) << "evaluating attribute '" << i->name << "'";
if (!std::regex_match(std::string(i->name), attrRegex)) {
for (auto& [_, i] : *v.attrs) {
DLOG(INFO) << "evaluating attribute '" << i.name << "'";
if (!std::regex_match(std::string(i.name), attrRegex)) {
continue;
}
std::string pathPrefix2 = addToPath(pathPrefix, i->name);
std::string pathPrefix2 = addToPath(pathPrefix, i.name);
if (combineChannels) {
getDerivations(state, *i->value, pathPrefix2, autoArgs, drvs, done,
getDerivations(state, *i.value, pathPrefix2, autoArgs, drvs, done,
ignoreAssertionFailures);
} else if (getDerivation(state, *i->value, pathPrefix2, drvs, done,
} else if (getDerivation(state, *i.value, pathPrefix2, drvs, done,
ignoreAssertionFailures)) {
/* If the value of this attribute is itself a set,
should we recurse into it? => Only if it has a
`recurseForDerivations = true' attribute. */
if (i->value->type == tAttrs) {
Bindings::iterator j = i->value->attrs->find(
if (i.value->type == tAttrs) {
Bindings::iterator j = i.value->attrs->find(
state.symbols.Create("recurseForDerivations"));
if (j != i->value->attrs->end() &&
if (j != i.value->attrs->end() &&
state.forceBool(*j->second.value, *j->second.pos)) {
getDerivations(state, *i->value, pathPrefix2, autoArgs, drvs, done,
getDerivations(state, *i.value, pathPrefix2, autoArgs, drvs, done,
ignoreAssertionFailures);
}
}