split error and raise

This commit is contained in:
Yuichi Nishiwaki 2014-02-19 02:11:29 +09:00
parent 54c0ded876
commit 6e3a2b176a
1 changed files with 12 additions and 6 deletions

View File

@ -18,6 +18,17 @@ pic_errmsg(pic_state *pic)
return pic->err->msg->str;
}
NORETURN static void
raise(pic_state *pic, struct pic_error *e)
{
pic->err = e;
if (! pic->jmp) {
puts(pic_errmsg(pic));
abort();
}
longjmp(*pic->jmp, 1);
}
NORETURN static void
error(pic_state *pic, struct pic_string *msg, pic_value irrs)
{
@ -28,12 +39,7 @@ error(pic_state *pic, struct pic_string *msg, pic_value irrs)
e->msg = msg;
e->irrs = irrs;
pic->err = e;
if (! pic->jmp) {
puts(pic_errmsg(pic));
abort();
}
longjmp(*pic->jmp, 1);
raise(pic, e);
}
void