refactor pic_push_try. use raw continuation API
This commit is contained in:
parent
e38732995e
commit
c7c771c861
26
error.c
26
error.c
|
@ -85,13 +85,20 @@ native_exception_handler(pic_state *pic)
|
|||
UNREACHABLE();
|
||||
}
|
||||
|
||||
static pic_value
|
||||
native_push_try(pic_state *pic)
|
||||
bool
|
||||
pic_push_try(pic_state *pic)
|
||||
{
|
||||
struct pic_escape *escape;
|
||||
|
||||
escape = pic_alloc(pic, sizeof(struct pic_escape));
|
||||
|
||||
if (pic_save_point(pic, escape)) {
|
||||
return false;
|
||||
} else {
|
||||
struct pic_proc *cont, *handler;
|
||||
size_t xp_len, xp_offset;
|
||||
|
||||
pic_get_args(pic, "l", &cont);
|
||||
cont = pic_make_cont(pic, escape);
|
||||
|
||||
handler = pic_make_proc(pic, native_exception_handler, "(native-exception-handler)");
|
||||
|
||||
|
@ -107,17 +114,8 @@ native_push_try(pic_state *pic)
|
|||
|
||||
*pic->xp++ = handler;
|
||||
|
||||
return pic_true_value();
|
||||
}
|
||||
|
||||
bool
|
||||
pic_push_try(pic_state *pic)
|
||||
{
|
||||
pic_value val;
|
||||
|
||||
val = pic_escape(pic, pic_make_proc(pic, native_push_try, "(native-push-try)"));
|
||||
|
||||
return pic_test(val);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue