summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-08-24 05:57:56 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-08-24 05:57:56 -0700
commiteee1e38f9b84618358ea7fa800f12b7a81d1d626 (patch)
treef824f00c8b91bb718c998759fc10d60517cbca52 /eval.c
parent95145297d6c1521612b69bf709f1a72879f5672a (diff)
downloadtxr-eee1e38f9b84618358ea7fa800f12b7a81d1d626.tar.gz
txr-eee1e38f9b84618358ea7fa800f12b7a81d1d626.tar.bz2
txr-eee1e38f9b84618358ea7fa800f12b7a81d1d626.zip
Check arg count when expanding defsymacro.
* eval.c (do_expand): Throw error if defsymacro form isn't a list of three elements, just like defparm and defparml do.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index c5935cc1..341dbcff 100644
--- a/eval.c
+++ b/eval.c
@@ -3435,6 +3435,9 @@ static val do_expand(val form, val menv)
val init_ex = expand(init, menv);
val form_ex = form;
+ if (sym == defsymacro_s && length(form) != three)
+ eval_error(form, lit("~s: two arguments expected"), sym, nao);
+
if (init != init_ex)
form_ex = rlcp(cons(sym, cons(name, cons(init_ex, nil))), form);