summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-03-20 22:03:35 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-03-20 22:03:35 -0700
commitb23232a7918f6fdb2d11d63c945592f28adb2cb3 (patch)
tree93379248bfac51601972d01f4a2d02b49b5afd57
parente5c32bdc1f1377df60be88efa0c49250a1d9cccf (diff)
downloadtxr-b23232a7918f6fdb2d11d63c945592f28adb2cb3.tar.gz
txr-b23232a7918f6fdb2d11d63c945592f28adb2cb3.tar.bz2
txr-b23232a7918f6fdb2d11d63c945592f28adb2cb3.zip
expander: bugfix: sys:for-op init forms.
* eval.c (do_expand): The first argument of the sys:for-op special operator isn't "vars" but a sequence of initialization forms. Name the variable appropriately. The neglected expansion of these forms is now performed.
-rw-r--r--eval.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/eval.c b/eval.c
index b4233e42..5166f9e5 100644
--- a/eval.c
+++ b/eval.c
@@ -4367,20 +4367,23 @@ again:
} else if (sym == quote_s || sym == dvbind_s) {
return form;
} else if (sym == for_op_s) {
- val vars = second(form);
+ val inits = second(form);
val cond = third(form);
val incs = fourth(form);
val forms = rest(rest(rest(rest(form))));
+ val inits_ex = expand_forms(inits, menv);
val cond_ex = expand_forms(cond, menv);
val incs_ex = expand_forms(incs, menv);
val forms_ex = expand_progn(forms, menv);
- if (cond == cond_ex && incs == incs_ex && forms == forms_ex) {
+ if (inits == inits_ex && cond == cond_ex &&
+ incs == incs_ex && forms == forms_ex)
+ {
return form;
} else {
- return rlcp(cons(sym, cons(vars, cons(cond_ex,
- cons(incs_ex,
- forms_ex)))), form);
+ return rlcp(cons(sym, cons(inits_ex, cons(cond_ex,
+ cons(incs_ex,
+ forms_ex)))), form);
}
} else if (sym == dohash_s) {
val spec = second(form);