aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-07-31 20:05:07 +0200
committerEelco Dolstra <edolstra@gmail.com>2018-07-31 20:05:07 +0200
commit45bcf5416a0ce53361fd37c6b27ba4ef6a34ce96 (patch)
treef3c8d56bfc3b9c237a1d62a8082969b30cc70a08 /src/libexpr/eval.cc
parent94b2e4e1be4526f2f85efd29a52a63e1858ea414 (diff)
parentc03d73c1cfbeb7c7d00a6b48111f152496e46c8f (diff)
Merge branch 'prim_mapAttr-fix' of https://github.com/volth/nix
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 2c8a0eb42..095320dc8 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -1076,6 +1076,8 @@ void EvalState::callPrimOp(Value & fun, Value & arg, Value & v, const Pos & pos)
void EvalState::callFunction(Value & fun, Value & arg, Value & v, const Pos & pos)
{
+ forceValue(fun, pos);
+
if (fun.type == tPrimOp || fun.type == tPrimOpApp) {
callPrimOp(fun, arg, v, pos);
return;
@@ -1091,10 +1093,8 @@ void EvalState::callFunction(Value & fun, Value & arg, Value & v, const Pos & po
auto & fun2 = *allocValue();
fun2 = fun;
/* !!! Should we use the attr pos here? */
- forceValue(*found->value, pos);
Value v2;
callFunction(*found->value, fun2, v2, pos);
- forceValue(v2, pos);
return callFunction(v2, arg, v, pos);
}
}
@@ -1181,7 +1181,6 @@ void EvalState::autoCallFunction(Bindings & args, Value & fun, Value & res)
if (fun.type == tAttrs) {
auto found = fun.attrs->find(sFunctor);
if (found != fun.attrs->end()) {
- forceValue(*found->value);
Value * v = allocValue();
callFunction(*found->value, fun, *v, noPos);
forceValue(*v);
@@ -1565,7 +1564,6 @@ string EvalState::coerceToString(const Pos & pos, Value & v, PathSet & context,
if (v.type == tAttrs) {
auto i = v.attrs->find(sToString);
if (i != v.attrs->end()) {
- forceValue(*i->value, pos);
Value v1;
callFunction(*i->value, v, v1, pos);
return coerceToString(pos, v1, context, coerceMore, copyToStore);