forceString(): Accept pos argument
This commit is contained in:
parent
976b949e4d
commit
4e340a983f
3 changed files with 5 additions and 5 deletions
|
@ -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);
|
copyContext(v, context);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,7 @@ public:
|
||||||
inline void forceList(Value & v, const Pos & pos);
|
inline void forceList(Value & v, const Pos & pos);
|
||||||
void forceFunction(Value & v, const Pos & pos); // either lambda or primop
|
void forceFunction(Value & v, const Pos & pos); // either lambda or primop
|
||||||
string forceString(Value & v, const Pos & pos = noPos);
|
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);
|
string forceStringNoCtx(Value & v, const Pos & pos = noPos);
|
||||||
|
|
||||||
/* Return true iff the value `v' denotes a derivation (i.e. a
|
/* Return true iff the value `v' denotes a derivation (i.e. a
|
||||||
|
|
|
@ -870,7 +870,7 @@ static void prim_toFile(EvalState & state, const Pos & pos, Value * * args, Valu
|
||||||
{
|
{
|
||||||
PathSet context;
|
PathSet context;
|
||||||
string name = state.forceStringNoCtx(*args[0], pos);
|
string name = state.forceStringNoCtx(*args[0], pos);
|
||||||
string contents = state.forceString(*args[1], context);
|
string contents = state.forceString(*args[1], context, pos);
|
||||||
|
|
||||||
PathSet refs;
|
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);
|
throw Error(format("unknown hash type ‘%1%’, at %2%") % type % pos);
|
||||||
|
|
||||||
PathSet context; // discarded
|
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);
|
mkString(v, printHash(hashString(ht, s)), context);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue