summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-25 22:43:12 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-25 22:43:12 -0700
commitddebbad496cdd19c6249211c8f00861161496124 (patch)
tree5bfeb26754d537d1a7f28e3e4df93a2a8c4bcd80
parent1adad3382e607bd91a47d6411d6f23095c4c7234 (diff)
downloadtxr-ddebbad496cdd19c6249211c8f00861161496124.tar.gz
txr-ddebbad496cdd19c6249211c8f00861161496124.tar.bz2
txr-ddebbad496cdd19c6249211c8f00861161496124.zip
return and return-from must throw, not abort.
* eval.c (op_return, op_return_from): If uw_block_return doesn't find a block, and just returns, then throw an exception rather than aborting.
-rw-r--r--eval.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index 8a2e99ed..bd0b40ea 100644
--- a/eval.c
+++ b/eval.c
@@ -1833,6 +1833,7 @@ static val op_return(val form, val env)
{
val retval = eval(second(form), env, form);
uw_block_return(nil, retval);
+ eval_error(form, lit("return: no anonymous block is visible"), nao);
abort();
}
@@ -1841,6 +1842,8 @@ static val op_return_from(val form, val env)
val name = second(form);
val retval = eval(third(form), env, form);
uw_block_return(name, retval);
+ eval_error(form, lit("return-from: no block named ~s is visible"),
+ name, nao);
abort();
}