mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm_eval.c (rb_throw_obj): inverted call flow. [ruby-core:22872]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b4bfc3aa79
commit
bc34d16363
2 changed files with 14 additions and 21 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Mar 13 18:10:06 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_eval.c (rb_throw_obj): inverted call flow. [ruby-core:22872]
|
||||
|
||||
Fri Mar 13 17:04:09 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* include/ruby/ruby.h (bool): not define to get rid of conflic
|
||||
|
|
31
vm_eval.c
31
vm_eval.c
|
@ -1127,8 +1127,6 @@ rb_mod_module_exec(int argc, VALUE *argv, VALUE mod)
|
|||
return yield_under(mod, mod, rb_ary_new4(argc, argv));
|
||||
}
|
||||
|
||||
NORETURN(static VALUE rb_f_throw _((int, VALUE *)));
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* throw(symbol [, obj])
|
||||
|
@ -1145,10 +1143,18 @@ static VALUE
|
|||
rb_f_throw(int argc, VALUE *argv)
|
||||
{
|
||||
VALUE tag, value;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &tag, &value);
|
||||
rb_throw_obj(tag, value);
|
||||
return Qnil; /* not reached */
|
||||
}
|
||||
|
||||
void
|
||||
rb_throw_obj(VALUE tag, VALUE value)
|
||||
{
|
||||
rb_thread_t *th = GET_THREAD();
|
||||
struct rb_vm_tag *tt = th->tag;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &tag, &value);
|
||||
while (tt) {
|
||||
if (tt->tag == tag) {
|
||||
tt->retval = value;
|
||||
|
@ -1164,29 +1170,12 @@ rb_f_throw(int argc, VALUE *argv)
|
|||
th->errinfo = NEW_THROW_OBJECT(tag, 0, TAG_THROW);
|
||||
|
||||
JUMP_TAG(TAG_THROW);
|
||||
#ifndef __GNUC__
|
||||
return Qnil; /* not reached */
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
rb_throw(const char *tag, VALUE val)
|
||||
{
|
||||
VALUE argv[2];
|
||||
|
||||
argv[0] = ID2SYM(rb_intern(tag));
|
||||
argv[1] = val;
|
||||
rb_f_throw(2, argv);
|
||||
}
|
||||
|
||||
void
|
||||
rb_throw_obj(VALUE tag, VALUE val)
|
||||
{
|
||||
VALUE argv[2];
|
||||
|
||||
argv[0] = tag;
|
||||
argv[1] = val;
|
||||
rb_f_throw(2, argv);
|
||||
rb_throw_obj(ID2SYM(rb_intern(tag)), val);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue