about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-07-05T15·42+0200
committerGitHub <noreply@github.com>2018-07-05T15·42+0200
commitf1f4c257f48ed863b2061bc47a2334fd37ca3eff (patch)
tree2fafd2bac4e2ccd465804aff8573d4a52ab17d06
parentddc9b87df15c68589ccbce59466f0e6530f5ba16 (diff)
parent1515c6561688b216d27c732c8df43b65909fa03e (diff)
Merge pull request #2275 from volth/issue-1776
[bugfix] lib.concatMap and lib.mapAttrs to be builtins
-rw-r--r--src/libexpr/primops.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 9b4751970167..e71e3a6d46cb 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -1365,10 +1365,11 @@ static void prim_mapAttrs(EvalState & state, const Pos & pos, Value * * args, Va
     state.mkAttrs(v, args[1]->attrs->size());
 
     for (auto & i : *args[1]->attrs) {
-        Value vName, vFun2;
-        mkString(vName, i.name);
-        state.callFunction(*args[0], vName, vFun2, pos);
-        state.callFunction(vFun2, *i.value, *state.allocAttr(v, i.name), pos);
+        Value * vName = state.allocValue();
+        Value * vFun2 = state.allocValue();
+        mkString(*vName, i.name);
+        state.callFunction(*args[0], *vName, *vFun2, pos);
+        mkApp(*state.allocAttr(v, i.name), *vFun2, *i.value);
     }
 }
 
@@ -1658,7 +1659,6 @@ static void prim_concatMap(EvalState & state, const Pos & pos, Value * * args, V
 
     for (unsigned int n = 0; n < nrLists; ++n) {
         Value * vElem = args[1]->listElems()[n];
-        state.forceValue(*vElem);
         state.callFunction(*args[0], *vElem, lists[n], pos);
         state.forceList(lists[n], pos);
         len += lists[n].listSize();