diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-01-28 22:20:32 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-01-28 22:20:32 -0800 |
commit | 175232485d4b41c7f1b221100abf58ddfa8c8187 (patch) | |
tree | 089fce1af2459544f8fe3b3bea86814e9e956489 | |
parent | 9fabcf6f295bcd8676dda77e74e8fc605f5df1f6 (diff) | |
download | txr-175232485d4b41c7f1b221100abf58ddfa8c8187.tar.gz txr-175232485d4b41c7f1b221100abf58ddfa8c8187.tar.bz2 txr-175232485d4b41c7f1b221100abf58ddfa8c8187.zip |
* 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)).
-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))); } } } |