prim_mapAttrs: must be lazy to avoid infinite recursion
This commit is contained in:
parent
841747b0e6
commit
e6bf1a79d7
1 changed files with 5 additions and 4 deletions
|
@ -1365,10 +1365,11 @@ static void prim_mapAttrs(EvalState & state, const Pos & pos, Value * * args, Va
|
||||||
state.mkAttrs(v, args[1]->attrs->size());
|
state.mkAttrs(v, args[1]->attrs->size());
|
||||||
|
|
||||||
for (auto & i : *args[1]->attrs) {
|
for (auto & i : *args[1]->attrs) {
|
||||||
Value vName, vFun2;
|
Value * vName = state.allocValue();
|
||||||
mkString(vName, i.name);
|
Value * vFun2 = state.allocValue();
|
||||||
state.callFunction(*args[0], vName, vFun2, pos);
|
mkString(*vName, i.name);
|
||||||
state.callFunction(vFun2, *i.value, *state.allocAttr(v, i.name), pos);
|
state.callFunction(*args[0], *vName, *vFun2, pos);
|
||||||
|
mkApp(*state.allocAttr(v, i.name), *vFun2, *i.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue