diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | eval.c | 17 |
2 files changed, 15 insertions, 9 deletions
@@ -1,5 +1,12 @@ 2015-01-28 Kaz Kylheku <kaz@kylheku.com> + * eval.c (get_opt_param_syms): Fix broken function. This + was choking on keywords like :env in the lambda list, + and failing to handle the nested patterns of macro + lambda lists. Failing case: (defmacro x (: opt :env foo)). + +2015-01-28 Kaz Kylheku <kaz@kylheku.com> + * eval.c (bind_macro_params): Bugfix: the colon argument's special meaning "treat the argument as missing" must apply only to optional parameters. @@ -513,6 +513,7 @@ static val expand_params(val params, val menv) params_ex); } +static val get_param_syms(val params); static val get_opt_param_syms(val params) { @@ -521,18 +522,16 @@ static val get_opt_param_syms(val params) } else if (atom(params)) { return nil; } else { - val form = car(params); + val spec = car(params); - if (atom(form) || !consp(cdr(form))) { /* sym, or no init form */ + if (atom(spec)) { val rest_syms = get_opt_param_syms(cdr(params)); - if (bindable(form)) - return cons(form, rest_syms); - if (bindable(car(form))) - return cons(car(form), rest_syms); + if (bindable(spec)) + return cons(spec, rest_syms); return rest_syms; - } else { /* has initform */ - val sym = car(form); - return cons(sym, get_opt_param_syms(cdr(params))); + } else { + val pat = car(spec); + return nappend2(get_param_syms(pat), get_opt_param_syms(cdr(params))); } } } |