mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm_eval.c: simplify
* vm_eval.c (rb_iterate0): simplify TAG_BREAK and TAG_RETRY by sharing common code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0a321b21fa
commit
dd6ab6b811
1 changed files with 13 additions and 25 deletions
26
vm_eval.c
26
vm_eval.c
|
@ -1130,36 +1130,24 @@ rb_iterate(VALUE (* it_proc) (VALUE), VALUE data1,
|
|||
}
|
||||
retval = (*it_proc) (data1);
|
||||
}
|
||||
else {
|
||||
const struct vm_throw_data *err = (struct vm_throw_data *)th->errinfo;
|
||||
if (state == TAG_BREAK) {
|
||||
const rb_control_frame_t *escape_cfp = THROW_DATA_CATCH_FRAME(err);
|
||||
else if (state == TAG_BREAK || state == TAG_RETRY) {
|
||||
const struct vm_throw_data *const err = (struct vm_throw_data *)th->errinfo;
|
||||
const rb_control_frame_t *const escape_cfp = THROW_DATA_CATCH_FRAME(err);
|
||||
|
||||
if (cfp == escape_cfp) {
|
||||
rb_vm_rewind_cfp(th, cfp);
|
||||
|
||||
state = 0;
|
||||
th->state = 0;
|
||||
th->errinfo = Qnil;
|
||||
retval = THROW_DATA_VAL(err);
|
||||
|
||||
rb_vm_rewind_cfp(th, cfp);
|
||||
if (state == TAG_RETRY) goto iter_retry;
|
||||
retval = THROW_DATA_VAL(err);
|
||||
}
|
||||
else if (0) {
|
||||
SDR(); fprintf(stderr, "%p, %p\n", cfp, escape_cfp);
|
||||
}
|
||||
}
|
||||
else if (state == TAG_RETRY) {
|
||||
const rb_control_frame_t *escape_cfp = THROW_DATA_CATCH_FRAME(err);
|
||||
|
||||
if (cfp == escape_cfp) {
|
||||
rb_vm_rewind_cfp(th, cfp);
|
||||
|
||||
state = 0;
|
||||
th->state = 0;
|
||||
th->errinfo = Qnil;
|
||||
goto iter_retry;
|
||||
}
|
||||
}
|
||||
}
|
||||
TH_POP_TAG();
|
||||
|
||||
if (state) {
|
||||
|
|
Loading…
Add table
Reference in a new issue