From efddb18b323b6a239108d73da03f1fb229faa581 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 24 Aug 2016 05:59:09 -0700 Subject: 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. --- eval.c | 13 ++++--------- 1 file 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; -- cgit v1.2.3