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
commit97753bee4c03e02a7cf8605dc4b5c98d556715a9 (patch)
tree93379248bfac51601972d01f4a2d02b49b5afd57
parent51f2b9ee934e4563d80674fcf58e6bd237cdc761 (diff)
downloadtxr-97753bee4c03e02a7cf8605dc4b5c98d556715a9.tar.gz
txr-97753bee4c03e02a7cf8605dc4b5c98d556715a9.tar.bz2
txr-97753bee4c03e02a7cf8605dc4b5c98d556715a9.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);