summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-08-24 05:59:09 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-08-24 05:59:09 -0700
commitb971254b74e21e42fd0b856a815fff0a2734a87c (patch)
treeac15813ec12a909219183d4e68726e56f0069ba6 /eval.c
parenteee1e38f9b84618358ea7fa800f12b7a81d1d626 (diff)
downloadtxr-b971254b74e21e42fd0b856a815fff0a2734a87c.tar.gz
txr-b971254b74e21e42fd0b856a815fff0a2734a87c.tar.bz2
txr-b971254b74e21e42fd0b856a815fff0a2734a87c.zip
Fix bug: global lexicals marked special anyway.
Variables defined with defvarl or defparml are being marked special, due to a mark_special call in the macro expander which existed before they were introduced. * eval.c (me_def_variable): We have to call mark_special at macro-expansion-time for defparm and defvar, rather than arrange for it to be called later, for the same reasons that the (now incorrect) mark_special call had been introduced in do_expand function for handling defvar. (do_expand): Do not call mark_special, because the symbol being handled here is defvarl: define lexical variable.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/eval.c b/eval.c
index 341dbcff..36c07890 100644
--- a/eval.c
+++ b/eval.c
@@ -2365,17 +2365,14 @@ static val me_def_variable(val form, val menv)
if (op != defvar_s && length(args) != two)
eval_error(form, lit("~s: two arguments expected"), op, nao);
+ if (op == defparm_s || op == defvar_s)
+ mark_special(sym);
+
return apply_frob_args(list(prog1_s,
cons(defvarl_s,
cons(sym, if2(op == defvar_s,
cons(initform, nil)))),
- if3(op == defparm_s || op == defvar_s,
- cons(list(sys_mark_special_s,
- list(quote_s, sym, nao),
- nao),
- setval),
- setval),
- nao));
+ setval, nao));
}
static val me_gen(val form, val menv)
@@ -3446,8 +3443,6 @@ static val do_expand(val form, val menv)
form_ex, form),
make_env(nil, nil, nil), form);
return cons(quote_s, cons(result, nil));
- } else {
- mark_special(name);
}
return form_ex;