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,7 +1153,6 @@ 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));
|
||||||
|
|
||||||
try {
|
|
||||||
Pos * pos2 = 0;
|
Pos * pos2 = 0;
|
||||||
|
|
||||||
Value * vAttrs = &vTmp;
|
Value * vAttrs = &vTmp;
|
||||||
|
|
@ -1164,7 +1163,11 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
|
||||||
state.forceValue(*vAttrs, pos);
|
state.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()) {
|
||||||
throw MissingField("attribute '%s' missing", name);
|
if (def) {
|
||||||
|
def->eval(state, env, v);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throwEvalError(pos, "attribute '%s' missing", name);
|
||||||
}
|
}
|
||||||
vAttrs = j->value;
|
vAttrs = j->value;
|
||||||
pos2 = j->pos;
|
pos2 = j->pos;
|
||||||
|
|
@ -1182,14 +1185,6 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
|
||||||
}
|
}
|
||||||
|
|
||||||
v = *vAttrs;
|
v = *vAttrs;
|
||||||
} catch (MissingField & field) {
|
|
||||||
if (def) {
|
|
||||||
def->eval(state, env, v);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
throwEvalError(pos, field.what());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue