1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 20:01:15 +02:00

prim_mapAttrs: `f' must be evaluated lazily to avoid infinite recursion

This commit is contained in:
volth 2018-07-06 21:49:51 +00:00
parent aa64e95bc8
commit 627e28ba33
2 changed files with 3 additions and 6 deletions

View file

@ -1359,7 +1359,6 @@ static void prim_functionArgs(EvalState & state, const Pos & pos, Value * * args
/* Apply a function to every element of an attribute set. */
static void prim_mapAttrs(EvalState & state, const Pos & pos, Value * * args, Value & v)
{
state.forceFunction(*args[0], pos);
state.forceAttrs(*args[1], pos);
state.mkAttrs(v, args[1]->attrs->size());
@ -1368,7 +1367,7 @@ static void prim_mapAttrs(EvalState & state, const Pos & pos, Value * * args, Va
Value * vName = state.allocValue();
Value * vFun2 = state.allocValue();
mkString(*vName, i.name);
state.callFunction(*args[0], *vName, *vFun2, pos);
mkApp(*vFun2, *args[0], *vName);
mkApp(*state.allocAttr(v, i.name), *vFun2, *i.value);
}
}