mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 06:52:43 +01:00
* Sync with the trunk.
This commit is contained in:
commit
587dc8aa00
16 changed files with 106 additions and 42 deletions
|
|
@ -750,13 +750,15 @@ void ExprOpImpl::eval(EvalState & state, Env & env, Value & v)
|
|||
|
||||
void ExprOpUpdate::eval(EvalState & state, Env & env, Value & v)
|
||||
{
|
||||
Value v2;
|
||||
state.evalAttrs(env, e1, v2);
|
||||
|
||||
state.cloneAttrs(v2, v);
|
||||
|
||||
Value v1, v2;
|
||||
state.evalAttrs(env, e1, v1);
|
||||
state.evalAttrs(env, e2, v2);
|
||||
|
||||
|
||||
if (v1.attrs->size() == 0) { v = v2; return; }
|
||||
if (v2.attrs->size() == 0) { v = v1; return; }
|
||||
|
||||
state.cloneAttrs(v1, v);
|
||||
|
||||
foreach (Bindings::iterator, i, *v2.attrs) {
|
||||
Attr & a = (*v.attrs)[i->first];
|
||||
mkCopy(a.value, i->second.value);
|
||||
|
|
|
|||
|
|
@ -788,13 +788,13 @@ static void prim_intersectAttrs(EvalState & state, Value * * args, Value & v)
|
|||
state.forceAttrs(*args[1]);
|
||||
|
||||
state.mkAttrs(v);
|
||||
|
||||
foreach (Bindings::iterator, i, *args[1]->attrs) {
|
||||
Bindings::iterator j = args[0]->attrs->find(i->first);
|
||||
if (j != args[0]->attrs->end()) {
|
||||
Attr & a = (*v.attrs)[i->first];
|
||||
mkCopy(a.value, i->second.value);
|
||||
a.pos = i->second.pos;
|
||||
|
||||
foreach (Bindings::iterator, i, *args[0]->attrs) {
|
||||
Bindings::iterator j = args[1]->attrs->find(i->first);
|
||||
if (j != args[1]->attrs->end()) {
|
||||
Attr & a = (*v.attrs)[j->first];
|
||||
mkCopy(a.value, j->second.value);
|
||||
a.pos = j->second.pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue