From c30054a5338027983dbc5cc463fd96eb0f1eeffa Mon Sep 17 00:00:00 2001 From: Benjamin Vedder Date: Mon, 10 Oct 2022 19:35:30 +0200 Subject: [PATCH] Squashed 'lispBM/lispBM/' changes from b741c823..ca26715a ca26715a fixed environemt handling bug related to function applications git-subtree-dir: lispBM/lispBM git-subtree-split: ca26715a429d1b7b5f0351ace1c8fedc09d7f4af --- src/eval_cps.c | 1 + src/qq_expand.c | 1 - tests/test_setvar_let_0.lisp | 10 ++++++++++ tests/test_setvar_let_1.lisp | 9 +++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tests/test_setvar_let_0.lisp create mode 100644 tests/test_setvar_let_1.lisp diff --git a/src/eval_cps.c b/src/eval_cps.c index 4563a14f..d21c472f 100644 --- a/src/eval_cps.c +++ b/src/eval_cps.c @@ -2002,6 +2002,7 @@ static void cont_application_args(eval_context_t *ctx) { // no arguments sptr[1] = count; lbm_stack_drop(&ctx->K, 1); + ctx->curr_env = env; cont_application(ctx); } else if (lbm_is_cons(rest)) { sptr[1] = env; diff --git a/src/qq_expand.c b/src/qq_expand.c index 04edf3c7..a9686cd9 100644 --- a/src/qq_expand.c +++ b/src/qq_expand.c @@ -37,7 +37,6 @@ lbm_value gen_cons(lbm_value a, lbm_value b) { lbm_cons(b, ENC_SYM_NIL))); } - lbm_value append(lbm_value front, lbm_value back) { return lbm_cons (ENC_SYM_APPEND, lbm_cons(front, diff --git a/tests/test_setvar_let_0.lisp b/tests/test_setvar_let_0.lisp new file mode 100644 index 00000000..a2daf975 --- /dev/null +++ b/tests/test_setvar_let_0.lisp @@ -0,0 +1,10 @@ + +(defun q () 10) + +(define b (let ((a 2)) + (progn + (setvar 'a (q)) + a))) + + +(= b 10) diff --git a/tests/test_setvar_let_1.lisp b/tests/test_setvar_let_1.lisp new file mode 100644 index 00000000..333ffe34 --- /dev/null +++ b/tests/test_setvar_let_1.lisp @@ -0,0 +1,9 @@ +(define q 10) + +(define b (let ((a 2)) + (progn + (setvar 'a q) + a))) + + +(= b 10)