deal with exceptions inside macroexpansion

This commit is contained in:
Yuichi Nishiwaki 2014-09-10 15:20:36 +09:00
parent 248ca95925
commit a193af3bef
1 changed files with 2 additions and 2 deletions

View File

@ -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);