fix(3p/nix/libexpr): Ensure ExprOpUpdate merges into destination
... this fixes nixpkgs eval!
This commit is contained in:
parent
55b1a47647
commit
af762abadc
1 changed files with 5 additions and 17 deletions
22
third_party/nix/src/libexpr/eval.cc
vendored
22
third_party/nix/src/libexpr/eval.cc
vendored
|
@ -1223,7 +1223,7 @@ void ExprOpImpl::eval(EvalState& state, Env& env, Value& v) {
|
||||||
mkBool(v, !state.evalBool(env, e1, pos) || state.evalBool(env, e2, pos));
|
mkBool(v, !state.evalBool(env, e1, pos) || state.evalBool(env, e2, pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExprOpUpdate::eval(EvalState& state, Env& env, Value& v) {
|
void ExprOpUpdate::eval(EvalState& state, Env& env, Value& dest) {
|
||||||
Value v1;
|
Value v1;
|
||||||
Value v2;
|
Value v2;
|
||||||
state.evalAttrs(env, e1, v1);
|
state.evalAttrs(env, e1, v1);
|
||||||
|
@ -1231,23 +1231,11 @@ void ExprOpUpdate::eval(EvalState& state, Env& env, Value& v) {
|
||||||
|
|
||||||
state.nrOpUpdates++;
|
state.nrOpUpdates++;
|
||||||
|
|
||||||
if (v1.attrs->empty()) {
|
state.mkAttrs(dest, /* capacity = */ 0);
|
||||||
v = v2;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (v2.attrs->empty()) {
|
|
||||||
v = v1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
state.mkAttrs(v, /* capacity = */ 0);
|
/* Merge the sets, preferring values from the second set. */
|
||||||
|
dest.attrs->merge(*v1.attrs);
|
||||||
/* Merge the sets, preferring values from the second set. Make
|
dest.attrs->merge(*v2.attrs);
|
||||||
sure to keep the resulting vector in sorted order. */
|
|
||||||
v.attrs->merge(v1.attrs);
|
|
||||||
v.attrs->merge(v2.attrs);
|
|
||||||
|
|
||||||
state.nrOpUpdateValuesCopied += v.attrs->size();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExprOpConcatLists::eval(EvalState& state, Env& env, Value& v) {
|
void ExprOpConcatLists::eval(EvalState& state, Env& env, Value& v) {
|
||||||
|
|
Loading…
Reference in a new issue