Make sure that thunks are restored properly if an exception occurs
Fixes Hydra bug #67.
This commit is contained in:
parent
4b07476848
commit
c56bc3d81c
1 changed files with 6 additions and 3 deletions
|
@ -21,13 +21,16 @@ LocalNoInlineNoReturn(void throwTypeError(const char * s, const string & s2))
|
||||||
void EvalState::forceValue(Value & v)
|
void EvalState::forceValue(Value & v)
|
||||||
{
|
{
|
||||||
if (v.type == tThunk) {
|
if (v.type == tThunk) {
|
||||||
ValueType saved = v.type;
|
Env * env = v.thunk.env;
|
||||||
|
Expr * expr = v.thunk.expr;
|
||||||
try {
|
try {
|
||||||
v.type = tBlackhole;
|
v.type = tBlackhole;
|
||||||
//checkInterrupt();
|
//checkInterrupt();
|
||||||
v.thunk.expr->eval(*this, *v.thunk.env, v);
|
expr->eval(*this, *env, v);
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
v.type = saved;
|
v.type = tThunk;
|
||||||
|
v.thunk.env = env;
|
||||||
|
v.thunk.expr = expr;
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue