remove pic_throw function

This commit is contained in:
Yuichi Nishiwaki 2015-06-04 13:23:20 +09:00
parent 34b6585287
commit 72baa9a52d
4 changed files with 12 additions and 11 deletions

View File

@ -7,7 +7,11 @@
PIC_NORETURN static void PIC_NORETURN static void
file_error(pic_state *pic, const char *msg) file_error(pic_state *pic, const char *msg)
{ {
pic_throw(pic, pic->sFILE, msg, pic_nil_value()); struct pic_error *e;
e = pic_make_error(pic, pic->sFILE, msg, pic_nil_value());
pic_raise(pic, pic_obj_value(e));
} }
static pic_value static pic_value

View File

@ -154,21 +154,15 @@ pic_raise(pic_state *pic, pic_value err)
} }
void void
pic_throw(pic_state *pic, pic_sym *type, const char *msg, pic_value irrs) pic_error(pic_state *pic, const char *msg, pic_value irrs)
{ {
struct pic_error *e; struct pic_error *e;
e = pic_make_error(pic, type, msg, irrs); e = pic_make_error(pic, pic_intern_cstr(pic, ""), msg, irrs);
pic_raise(pic, pic_obj_value(e)); pic_raise(pic, pic_obj_value(e));
} }
void
pic_error(pic_state *pic, const char *msg, pic_value irrs)
{
pic_throw(pic, pic_intern_cstr(pic, ""), msg, irrs);
}
static pic_value static pic_value
pic_error_with_exception_handler(pic_state *pic) pic_error_with_exception_handler(pic_state *pic)
{ {

View File

@ -56,7 +56,6 @@ struct pic_proc *pic_pop_handler(pic_state *);
pic_value pic_raise_continuable(pic_state *, pic_value); pic_value pic_raise_continuable(pic_state *, pic_value);
PIC_NORETURN void pic_raise(pic_state *, pic_value); PIC_NORETURN void pic_raise(pic_state *, pic_value);
PIC_NORETURN void pic_throw(pic_state *, pic_sym *, const char *, pic_list);
PIC_NORETURN void pic_error(pic_state *, const char *, pic_list); PIC_NORETURN void pic_error(pic_state *, const char *, pic_list);
#if defined(__cplusplus) #if defined(__cplusplus)

View File

@ -10,7 +10,11 @@ static pic_value read_nullable(pic_state *pic, struct pic_port *port, int c);
PIC_NORETURN static void PIC_NORETURN static void
read_error(pic_state *pic, const char *msg) read_error(pic_state *pic, const char *msg)
{ {
pic_throw(pic, pic->sREAD, msg, pic_nil_value()); struct pic_error *e;
e = pic_make_error(pic, pic->sREAD, msg, pic_nil_value());
pic_raise(pic, pic_obj_value(e));
} }
static int static int