diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-11-08 14:48:33 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-11-08 14:48:33 -0800 |
commit | 84af229255b1e5a594a54907adc317b61828a989 (patch) | |
tree | 3de55e9e06b1ccaa586947ceca866c6444403b85 /eval.c | |
parent | 4d9a7fdc21730824f69d6e33e497dade864a170f (diff) | |
download | txr-84af229255b1e5a594a54907adc317b61828a989.tar.gz txr-84af229255b1e5a594a54907adc317b61828a989.tar.bz2 txr-84af229255b1e5a594a54907adc317b61828a989.zip |
Variable init forms of for go inside nil block.
* eval.c (op_for): Establish the block before doing any
evaluation, subject to the compatibility option.
* txr.1: Updated documentation for for, exchanging
steps 1 and 2. Added compatibility notes.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1811,11 +1811,15 @@ static val op_for(val form, val env) val incs = fourth(form); val forms = rest(rest(rest(rest(form)))); val new_env; - val new_bindings = bindings_helper(vars, env, eq(forsym, for_star_s), - &new_env, t, form); + int oldscope = opt_compat && opt_compat <= 123; + + if (oldscope) + (void) bindings_helper(vars, env, eq(forsym, for_star_s), &new_env, t, form); + uw_block_begin (nil, result); - (void) new_bindings; + if (!oldscope) + (void) bindings_helper(vars, env, eq(forsym, for_star_s), &new_env, t, form); for (; cond == nil || eval(car(cond), new_env, form); eval_progn(incs, new_env, form)) |