klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

commit c6c298863a93e9ecab8cf737457bfe6804b79c2c
parent e40f7907d6cfd6036e7d162e105f916f908ad5bc
Author: Andres Navarro <canavarro82@gmail.com>
Date:   Sat, 16 Apr 2011 11:54:30 -0300

Bugfix: wasn't rooting bodies in Scond.

Diffstat:
Msrc/kgcontrol.c | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/kgcontrol.c b/src/kgcontrol.c @@ -164,16 +164,14 @@ TValue split_check_cond_clauses(klisp_State *K, TValue clauses, } unmark_list(K, clauses); + + TValue cars = kcutoff_dummy1(K); + TValue cdrs = kcutoff_dummy2(K); if (!ttispair(tail) && !ttisnil(tail)) { - UNUSED(kcutoff_dummy1(K)); - UNUSED(kcutoff_dummy2(K)); klispE_throw(K, "$cond: expected list (clauses)"); return KNIL; } else { - - TValue cars = kcutoff_dummy1(K); - TValue cdrs = kcutoff_dummy2(K); /* check copy list could throw an error and leave the dummys full, use tvs_push instead */ krooted_tvs_push(K, cars); @@ -258,6 +256,7 @@ void Scond(klisp_State *K, TValue *xparams, TValue ptree, TValue denv) TValue bodies; TValue tests = split_check_cond_clauses(K, ptree, &bodies); krooted_tvs_push(K, tests); + krooted_tvs_push(K, bodies); TValue obj; if (ttisnil(tests)) { @@ -276,6 +275,7 @@ void Scond(klisp_State *K, TValue *xparams, TValue ptree, TValue denv) } krooted_tvs_pop(K); + krooted_tvs_pop(K); kapply_cc(K, obj); }