macro transformer should never return macro objects
This commit is contained in:
parent
464ecdd452
commit
c5d9972d2e
10
src/macro.c
10
src/macro.c
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue