Created
August 4, 2009 18:03
-
-
Save methodmissing/161384 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static VALUE | |
| rb_f_throw(argc, argv) | |
| int argc; | |
| VALUE *argv; | |
| { | |
| VALUE tag, value; | |
| struct tag *tt = prot_tag; | |
| rb_scan_args(argc, argv, "11", &tag, &value); | |
| tag = ID2SYM(rb_to_id(tag)); | |
| while (tt) { | |
| if (tt->tag == tag) { | |
| tt->dst = tag; | |
| tt->retval = value; | |
| break; | |
| } | |
| if (tt->tag == PROT_THREAD) { | |
| rb_raise(rb_eThreadError, "uncaught throw `%s' in thread 0x%lx", | |
| rb_id2name(SYM2ID(tag)), | |
| curr_thread); | |
| } | |
| tt = tt->prev; | |
| } | |
| if (!tt) { | |
| rb_name_error(SYM2ID(tag), "uncaught throw `%s'", rb_id2name(SYM2ID(tag))); | |
| } | |
| rb_trap_restore_mask(); | |
| JUMP_TAG(TAG_THROW); | |
| #ifndef __GNUC__ | |
| return Qnil; /* not reached */ | |
| #endif | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment