diff --git a/src/macro.c b/src/macro.c index 5db52872..7a5bbe83 100644 --- a/src/macro.c +++ b/src/macro.c @@ -445,10 +445,6 @@ macroexpand_node(pic_state *pic, pic_value expr, struct pic_senv *senv) return pic_cons(pic, pic_symbol_value(tag), macroexpand_list(pic, pic_cdr(pic, expr), senv)); } - else if (tag == pic->sSETBANG || tag == pic->sIF || tag == pic->sBEGIN) { - return pic_cons(pic, car, macroexpand_list(pic, pic_cdr(pic, expr), senv)); - } - else if (tag == pic->sQUOTE) { return pic_cons(pic, car, pic_cdr(pic, expr)); } @@ -830,10 +826,10 @@ static pic_value ir_macro_wrap(pic_state *pic, pic_value expr, struct pic_senv *use_env, pic_value *assoc) { if (pic_sym_p(expr)) { - pic_value ren; - ren = macroexpand(pic, expr, use_env); - *assoc = pic_acons(pic, ren, expr, *assoc); - return ren; + pic_value r; + r = pic_sym_value(symbol_rename(pic, pic_sym(expr), use_env)); + *assoc = pic_acons(pic, r, expr, *assoc); + return r; } else if (pic_pair_p(expr)) { return pic_cons(pic, @@ -848,18 +844,12 @@ ir_macro_wrap(pic_state *pic, pic_value expr, struct pic_senv *use_env, pic_valu static pic_value 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; if (pic_test(r = pic_assq(pic, expr, *assoc))) { return pic_cdr(pic, r); } - r = macroexpand(pic, expr, mac_env); - if (pic_macro_p(r)) { - return expr; - } - else { - return r; - } + return pic_sym_value(symbol_rename(pic, pic_sym(expr), mac_env)); } else if (pic_pair_p(expr)) { return pic_cons(pic,