static void err_append(const char *s) { VALUE err = rb_vm_current_exception(); if (rb_vm_parse_in_eval()) { if (err == Qnil) { err = rb_exc_new2(rb_eSyntaxError, s); rb_vm_set_current_exception(err); } else { VALUE str = rb_obj_as_string(err); rb_str_cat2(str, "\n"); rb_str_cat2(str, s); rb_vm_set_current_exception(rb_exc_new3(rb_eSyntaxError, str)); } } else { if (err == Qnil) { err = rb_exc_new2(rb_eSyntaxError, "compile error"); rb_vm_set_current_exception(err); } rb_write_error(s); rb_write_error("\n"); } }
static #if __LP64__ // This method can't be inlined in 32-bit because @try compiles as a call // to setjmp(). force_inline #endif VALUE __rb_vm_objc_dispatch(rb_vm_objc_stub_t *stub, IMP imp, id rcv, SEL sel, int argc, const VALUE *argv) { @try { return (*stub)(imp, rcv, sel, argc, argv); } @catch (id exc) { bool created = false; VALUE rbexc = rb_oc2rb_exception(exc, &created); #if __LP64__ if (rb_vm_current_exception() == Qnil) { rb_vm_set_current_exception(rbexc); throw; } #endif if (created) { rb_exc_raise(rbexc); } throw; } abort(); // never reached }