diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/class.c | 10 | ||||
| -rw-r--r-- | src/vm.c | 3 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/class.c b/src/class.c index 0922b3cff..fdb10d271 100644 --- a/src/class.c +++ b/src/class.c @@ -330,8 +330,14 @@ mrb_class_get(mrb_state *mrb, const char *name) MRB_API struct RClass * mrb_exc_get(mrb_state *mrb, const char *name) { - struct RClass *exc = mrb_class_get_under(mrb, mrb->object_class, name); - struct RClass *e = exc; + struct RClass *exc, *e; + mrb_value c = mrb_const_get(mrb, mrb_obj_value(mrb->object_class), + mrb_intern_cstr(mrb, name)); + + if (mrb_type(c) != MRB_TT_CLASS) { + mrb_raise(mrb, mrb->eException_class, "exception corrupted"); + } + exc = e = mrb_class_ptr(c); while (e) { if (e == mrb->eException_class) @@ -569,6 +569,7 @@ eval_under(mrb_state *mrb, mrb_value self, mrb_value blk, struct RClass *c) p = mrb_proc_ptr(blk); ci->proc = p; ci->argc = 1; + ci->mid = ci[-1].mid; if (MRB_PROC_CFUNC_P(p)) { stack_extend(mrb, 3, 0); mrb->c->stack[0] = self; @@ -1345,7 +1346,7 @@ RETRY_TRY_BLOCK: int a = GETARG_A(i); int n = GETARG_C(i); - if (mid == 0 || !mrb->c->ci->target_class) { + if (mid == 0 || !ci->target_class) { mrb_value exc; exc = mrb_exc_new_str_lit(mrb, E_NOMETHOD_ERROR, "super called outside of method"); |
