From 62e52be061047cf55a477295c4d1913b319f1845 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Fri, 10 Jan 2014 17:55:02 +0900 Subject: [PATCH] [bugfix] macroexpand may return a non-symbol value even if passed a symbol. --- src/macro.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/macro.c b/src/macro.c index 15cff9a1..4c9eec94 100644 --- a/src/macro.c +++ b/src/macro.c @@ -664,12 +664,19 @@ er_macro_rename(pic_state *pic) { pic_sym sym; struct pic_senv *mac_env; + pic_value v; pic_get_args(pic, "m", &sym); mac_env = pic_senv_ptr(pic_proc_cv_ref(pic, pic_get_proc(pic), 1)); - return macroexpand(pic, pic_symbol_value(sym), mac_env); + v = macroexpand(pic, pic_symbol_value(sym), mac_env); + if (pic_syntax_p(v)) { + return pic_symbol_value(sym); + } + else { + return v; + } } static pic_value