mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
Revert "Make ifs and asserts tail-recursive"
This reverts commit 273322c773
.
This commit is contained in:
parent
f7e077ad27
commit
2caab81660
2 changed files with 4 additions and 11 deletions
|
@ -540,8 +540,9 @@ void EvalState::eval(Expr * e, Value & v)
|
|||
}
|
||||
|
||||
|
||||
inline bool EvalState::evalBool(Env & env, Expr * e, Value & v)
|
||||
inline bool EvalState::evalBool(Env & env, Expr * e)
|
||||
{
|
||||
Value v;
|
||||
e->eval(*this, env, v);
|
||||
if (v.type != tBool)
|
||||
throwTypeError("value is %1% while a Boolean was expected", v);
|
||||
|
@ -549,13 +550,6 @@ inline bool EvalState::evalBool(Env & env, Expr * e, Value & v)
|
|||
}
|
||||
|
||||
|
||||
inline bool EvalState::evalBool(Env & env, Expr * e)
|
||||
{
|
||||
Value v;
|
||||
return evalBool(env, e, v);
|
||||
}
|
||||
|
||||
|
||||
inline void EvalState::evalAttrs(Env & env, Expr * e, Value & v)
|
||||
{
|
||||
e->eval(*this, env, v);
|
||||
|
@ -945,13 +939,13 @@ void ExprWith::eval(EvalState & state, Env & env, Value & v)
|
|||
|
||||
void ExprIf::eval(EvalState & state, Env & env, Value & v)
|
||||
{
|
||||
(state.evalBool(env, cond, v) ? then : else_)->eval(state, env, v);
|
||||
(state.evalBool(env, cond) ? then : else_)->eval(state, env, v);
|
||||
}
|
||||
|
||||
|
||||
void ExprAssert::eval(EvalState & state, Env & env, Value & v)
|
||||
{
|
||||
if (!state.evalBool(env, cond, v))
|
||||
if (!state.evalBool(env, cond))
|
||||
throwAssertionError("assertion failed at %1%", pos);
|
||||
body->eval(state, env, v);
|
||||
}
|
||||
|
|
|
@ -144,7 +144,6 @@ public:
|
|||
|
||||
/* Evaluation the expression, then verify that it has the expected
|
||||
type. */
|
||||
inline bool evalBool(Env & env, Expr * e, Value & v);
|
||||
inline bool evalBool(Env & env, Expr * e);
|
||||
inline void evalAttrs(Env & env, Expr * e, Value & v);
|
||||
|
||||
|
|
Loading…
Reference in a new issue