deal with exceptions inside macroexpansion
This commit is contained in:
parent
248ca95925
commit
a193af3bef
4
macro.c
4
macro.c
|
@ -358,8 +358,6 @@ pic_macroexpand(pic_state *pic, pic_value expr, struct pic_lib *lib)
|
||||||
struct pic_lib *prev;
|
struct pic_lib *prev;
|
||||||
pic_value v;
|
pic_value v;
|
||||||
|
|
||||||
assert(pic_eq_p(lib->env->defer, pic_nil_value()));
|
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
puts("before expand:");
|
puts("before expand:");
|
||||||
pic_debug(pic, expr);
|
pic_debug(pic, expr);
|
||||||
|
@ -370,6 +368,8 @@ pic_macroexpand(pic_state *pic, pic_value expr, struct pic_lib *lib)
|
||||||
prev = pic->lib;
|
prev = pic->lib;
|
||||||
pic->lib = lib;
|
pic->lib = lib;
|
||||||
|
|
||||||
|
lib->env->defer = pic_nil_value(); /* the last expansion could fail and leave defer field old */
|
||||||
|
|
||||||
v = macroexpand(pic, expr, lib->env);
|
v = macroexpand(pic, expr, lib->env);
|
||||||
|
|
||||||
macroexpand_deferred(pic, lib->env);
|
macroexpand_deferred(pic, lib->env);
|
||||||
|
|
Loading…
Reference in New Issue