From 4e340a983f928973d3915455d46a4bbadbc3269c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 25 Nov 2014 10:23:36 +0100 Subject: forceString(): Accept pos argument --- src/libexpr/eval.cc | 4 ++-- src/libexpr/eval.hh | 2 +- src/libexpr/primops.cc | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/libexpr') diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 81774974a9..ebb28021c1 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -1257,9 +1257,9 @@ void copyContext(const Value & v, PathSet & context) } -string EvalState::forceString(Value & v, PathSet & context) +string EvalState::forceString(Value & v, PathSet & context, const Pos & pos) { - string s = forceString(v); + string s = forceString(v, pos); copyContext(v, context); return s; } diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index d066f7fd58..8bf65c2c55 100644 --- a/src/libexpr/eval.hh +++ b/src/libexpr/eval.hh @@ -200,7 +200,7 @@ public: inline void forceList(Value & v, const Pos & pos); void forceFunction(Value & v, const Pos & pos); // either lambda or primop string forceString(Value & v, const Pos & pos = noPos); - string forceString(Value & v, PathSet & context); + string forceString(Value & v, PathSet & context, const Pos & pos = noPos); string forceStringNoCtx(Value & v, const Pos & pos = noPos); /* Return true iff the value `v' denotes a derivation (i.e. a diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index e6edffa466..ed50c8091b 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -870,7 +870,7 @@ static void prim_toFile(EvalState & state, const Pos & pos, Value * * args, Valu { PathSet context; string name = state.forceStringNoCtx(*args[0], pos); - string contents = state.forceString(*args[1], context); + string contents = state.forceString(*args[1], context, pos); PathSet refs; @@ -1427,7 +1427,7 @@ static void prim_hashString(EvalState & state, const Pos & pos, Value * * args, throw Error(format("unknown hash type ‘%1%’, at %2%") % type % pos); PathSet context; // discarded - string s = state.forceString(*args[1], context); + string s = state.forceString(*args[1], context, pos); mkString(v, printHash(hashString(ht, s)), context); }; -- cgit 1.4.1