1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 14:51:16 +02:00

remove lazy-pos forceValue

almost all uses of this are interactive, except for deepSeq. deepSeq is
going to be expensive and rare enough to not care much about, and
Value::determinePos should usually be cheap enough to not be too much of
a burden in any case.
This commit is contained in:
pennae 2023-12-11 15:48:24 +01:00
parent f9aee2f2c4
commit 69ed4aee61
9 changed files with 10 additions and 21 deletions

View file

@ -81,15 +81,7 @@ Env & EvalState::allocEnv(size_t size)
}
[[gnu::always_inline]]
void EvalState::forceValue(Value & v, const PosIdx pos)
{
forceValue(v, [&]() { return pos; });
}
template<typename Callable>
void EvalState::forceValue(Value & v, Callable getPos)
{
if (v.isThunk()) {
Env * env = v.thunk.env;
@ -110,7 +102,7 @@ void EvalState::forceValue(Value & v, Callable getPos)
// only one black hole can *throw* in any given eval stack so we need not
// check whether the position is set already.
if (v.isBlackhole())
e.err.errPos = positions[getPos()];
e.err.errPos = positions[pos];
throw;
}
}