diff --git a/include/picrin/error.h b/include/picrin/error.h index 1c62294f..024d5d29 100644 --- a/include/picrin/error.h +++ b/include/picrin/error.h @@ -11,6 +11,9 @@ extern "C" { struct pic_jmpbuf { jmp_buf here; + pic_callinfo *ci; + pic_value *sp; + pic_code *ip; jmp_buf *prev_jmp; struct pic_jmpbuf *prev; }; diff --git a/src/error.c b/src/error.c index 2c319b79..c4d02cf2 100644 --- a/src/error.c +++ b/src/error.c @@ -41,6 +41,10 @@ pic_push_try(pic_state *pic) try_jmp = pic_alloc(pic, sizeof(struct pic_jmpbuf)); + try_jmp->ci = pic->ci; + try_jmp->sp = pic->sp; + try_jmp->ip = pic->ip; + try_jmp->prev_jmp = pic->jmp; pic->jmp = &try_jmp->here; @@ -55,6 +59,10 @@ pic_pop_try(pic_state *pic) assert(pic->jmp == &pic->try_jmps->here); + pic->ci = pic->try_jmps->ci; + pic->sp = pic->try_jmps->sp; + pic->ip = pic->try_jmps->ip; + pic->jmp = pic->try_jmps->prev_jmp; prev = pic->try_jmps->prev;