diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-03-19 18:40:58 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-03-19 18:40:58 +0900 |
| commit | d01118d2617ea6a0c6f32789cee072eb3dbf42ee (patch) | |
| tree | 092d9cd7183408bd552f90f1300474b8e30d2c15 /src | |
| parent | 8d1468eab456a21bbd7a8e8a6a9b87f27fa69062 (diff) | |
| download | mruby-d01118d2617ea6a0c6f32789cee072eb3dbf42ee.tar.gz mruby-d01118d2617ea6a0c6f32789cee072eb3dbf42ee.zip | |
OP_RESCUE refactored; ref #3519
Diffstat (limited to 'src')
| -rw-r--r-- | src/vm.c | 26 |
1 files changed, 9 insertions, 17 deletions
@@ -1091,16 +1091,17 @@ RETRY_TRY_BLOCK: int c = GETARG_C(i); mrb_value exc; + if (c == 0) { + exc = mrb_obj_value(mrb->exc); + mrb->exc = 0; + } + else { /* continued; exc taken from R(A) */ + exc = regs[a]; + } if (b != 0) { mrb_value e = regs[b]; struct RClass *ec; - if (c == 0) { - exc = mrb_obj_value(mrb->exc); - } - else { /* continued; exc taken from R(A) */ - exc = regs[a]; - } switch (mrb_type(e)) { case MRB_TT_CLASS: case MRB_TT_MODULE: @@ -1110,20 +1111,11 @@ RETRY_TRY_BLOCK: break; } ec = mrb_class_ptr(e); - if (mrb_obj_is_kind_of(mrb, exc, ec)) { - regs[b] = mrb_true_value(); - } - else { - regs[b] = mrb_false_value(); - } - } - else if (c == 0) { - exc = mrb_obj_value(mrb->exc); + regs[b] = mrb_bool_value(mrb_obj_is_kind_of(mrb, exc, ec)); } if (a != 0 && c == 0) { - regs[GETARG_A(i)] = exc; + regs[a] = exc; } - mrb->exc = 0; NEXT; } |
