[bugfix] macroexpand may return a non-symbol value even if passed a symbol.

This commit is contained in:
Yuichi Nishiwaki 2014-01-10 17:55:02 +09:00
parent 57253f9a6c
commit 62e52be061
1 changed files with 8 additions and 1 deletions

View File

@ -664,12 +664,19 @@ er_macro_rename(pic_state *pic)
{ {
pic_sym sym; pic_sym sym;
struct pic_senv *mac_env; struct pic_senv *mac_env;
pic_value v;
pic_get_args(pic, "m", &sym); pic_get_args(pic, "m", &sym);
mac_env = pic_senv_ptr(pic_proc_cv_ref(pic, pic_get_proc(pic), 1)); 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 static pic_value