1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-19 16:59:35 +01:00

Simplify the forcing of nested records

This commit is contained in:
regnat 2021-06-03 10:35:51 +02:00
parent 7c718646cb
commit 6ec852e7f0

View file

@ -1212,18 +1212,16 @@ bool EvalState::getAttrField(Value & attrs, const std::vector<Symbol> & selector
for (auto & name : selector) { for (auto & name : selector) {
nrLookups++; nrLookups++;
Bindings::iterator j; Bindings::iterator j;
forceValue(*vAttrs, pos);
if (vAttrs->type() != nAttrs || if (vAttrs->type() != nAttrs ||
(j = vAttrs->attrs->find(name)) == vAttrs->attrs->end()) { (j = vAttrs->attrs->find(name)) == vAttrs->attrs->end()) {
return false; return false;
} }
vAttrs = j->value; vAttrs = j->value;
pos2 = j->pos; pos2 = j->pos;
forceValue(*vAttrs, pos2 != NULL ? *pos2 : pos );
if (countCalls && pos2) attrSelects[*pos2]++; if (countCalls && pos2) attrSelects[*pos2]++;
} }
forceValue(*vAttrs, ( pos2 != NULL ? *pos2 : pos ) );
} catch (Error & e) { } catch (Error & e) {
if (pos2 && pos2->file != sDerivationNix) { if (pos2 && pos2->file != sDerivationNix) {
vector<string> strSelector; vector<string> strSelector;