mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-04 03:36:36 +02:00
fixing a small bug that missed some tail-recursion cases
This commit is contained in:
parent
3a47a903e8
commit
bb251082f6
2 changed files with 4 additions and 1 deletions
1
eval.c
1
eval.c
|
@ -960,6 +960,7 @@ static void generate_general_app (sexp ctx, sexp app) {
|
|||
emit(ctx, (tailp ? OP_TAIL_CALL : OP_CALL));
|
||||
emit_word(ctx, (sexp_uint_t)sexp_make_fixnum(len));
|
||||
|
||||
sexp_context_tailp(ctx) = tailp;
|
||||
sexp_context_depth(ctx) -= len;
|
||||
sexp_gc_release1(ctx);
|
||||
}
|
||||
|
|
4
init.scm
4
init.scm
|
@ -122,7 +122,9 @@
|
|||
#f
|
||||
((lambda (cl)
|
||||
(if (compare 'else (car cl))
|
||||
(cons (rename 'begin) (cdr cl))
|
||||
(if (pair? (cddr expr))
|
||||
(error "non-final else in cond" expr)
|
||||
(cons (rename 'begin) (cdr cl)))
|
||||
(if (if (null? (cdr cl)) #t (compare '=> (cadr cl)))
|
||||
(list (list (rename 'lambda) (list (rename 'tmp))
|
||||
(list (rename 'if) (rename 'tmp)
|
||||
|
|
Loading…
Add table
Reference in a new issue