mirror of
https://github.com/NixOS/nix.git
synced 2025-11-20 01:09:37 +01:00
Try removing the exception
This commit is contained in:
parent
2021b1d8d1
commit
4ca1a0b864
1 changed files with 25 additions and 30 deletions
|
|
@ -1153,44 +1153,39 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
|
||||||
for (auto & i : attrPath)
|
for (auto & i : attrPath)
|
||||||
selector.push_back(getName(i, state, env));
|
selector.push_back(getName(i, state, env));
|
||||||
|
|
||||||
|
Pos * pos2 = 0;
|
||||||
|
|
||||||
|
Value * vAttrs = &vTmp;
|
||||||
try {
|
try {
|
||||||
Pos * pos2 = 0;
|
for (auto & name : selector) {
|
||||||
|
nrLookups++;
|
||||||
Value * vAttrs = &vTmp;
|
Bindings::iterator j;
|
||||||
try {
|
state.forceValue(*vAttrs, pos);
|
||||||
for (auto & name : selector) {
|
if (vAttrs->type() != nAttrs ||
|
||||||
nrLookups++;
|
(j = vAttrs->attrs->find(name)) == vAttrs->attrs->end()) {
|
||||||
Bindings::iterator j;
|
if (def) {
|
||||||
state.forceValue(*vAttrs, pos);
|
def->eval(state, env, v);
|
||||||
if (vAttrs->type() != nAttrs ||
|
return;
|
||||||
(j = vAttrs->attrs->find(name)) == vAttrs->attrs->end()) {
|
|
||||||
throw MissingField("attribute '%s' missing", name);
|
|
||||||
}
|
}
|
||||||
vAttrs = j->value;
|
throwEvalError(pos, "attribute '%s' missing", name);
|
||||||
pos2 = j->pos;
|
|
||||||
if (state.countCalls && pos2) state.attrSelects[*pos2]++;
|
|
||||||
}
|
}
|
||||||
|
vAttrs = j->value;
|
||||||
state.forceValue(*vAttrs, ( pos2 != NULL ? *pos2 : pos ) );
|
pos2 = j->pos;
|
||||||
|
if (state.countCalls && pos2) state.attrSelects[*pos2]++;
|
||||||
} catch (Error & e) {
|
|
||||||
if (pos2 && pos2->file != state.sDerivationNix) {
|
|
||||||
vector<string> strSelector;
|
|
||||||
addErrorTrace(e, *pos2, "while evaluating the attribute '%1%'", concatStringsSep(".", selector));
|
|
||||||
}
|
|
||||||
throw;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
v = *vAttrs;
|
state.forceValue(*vAttrs, ( pos2 != NULL ? *pos2 : pos ) );
|
||||||
} catch (MissingField & field) {
|
|
||||||
if (def) {
|
} catch (Error & e) {
|
||||||
def->eval(state, env, v);
|
if (pos2 && pos2->file != state.sDerivationNix) {
|
||||||
return;
|
vector<string> strSelector;
|
||||||
} else {
|
addErrorTrace(e, *pos2, "while evaluating the attribute '%1%'", concatStringsSep(".", selector));
|
||||||
throwEvalError(pos, field.what());
|
|
||||||
}
|
}
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
v = *vAttrs;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue