macro transformer should never return macro objects

This commit is contained in:
Yuichi Nishiwaki 2014-03-29 08:57:15 +09:00
parent 464ecdd452
commit c5d9972d2e
1 changed files with 2 additions and 8 deletions

View File

@ -848,18 +848,12 @@ ir_macro_wrap(pic_state *pic, pic_value expr, struct pic_senv *use_env, pic_valu
static pic_value static pic_value
ir_macro_unwrap(pic_state *pic, pic_value expr, struct pic_senv *mac_env, pic_value *assoc) ir_macro_unwrap(pic_state *pic, pic_value expr, struct pic_senv *mac_env, pic_value *assoc)
{ {
if (pic_sym_p(expr) || pic_macro_p(expr)) { if (pic_sym_p(expr)) {
pic_value r; pic_value r;
if (pic_test(r = pic_assq(pic, expr, *assoc))) { if (pic_test(r = pic_assq(pic, expr, *assoc))) {
return pic_cdr(pic, r); return pic_cdr(pic, r);
} }
r = macroexpand(pic, expr, mac_env); return pic_sym_value(symbol_rename(pic, pic_sym(expr), mac_env));
if (pic_macro_p(r)) {
return expr;
}
else {
return r;
}
} }
else if (pic_pair_p(expr)) { else if (pic_pair_p(expr)) {
return pic_cons(pic, return pic_cons(pic,