diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-03-11 10:22:17 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-03-11 10:22:17 +0900 |
| commit | 7590482d4873474f7a435f2533831358bca80a97 (patch) | |
| tree | 53e250597a3adcce9a38edb49e6e15d5c4652020 /src | |
| parent | 4b3e6cf1691da5a9c87ef4d55004f7ea8b3e383d (diff) | |
| parent | 431f474ba34a485281692ab08df16d4f7daa8750 (diff) | |
| download | mruby-7590482d4873474f7a435f2533831358bca80a97.tar.gz mruby-7590482d4873474f7a435f2533831358bca80a97.zip | |
Merge branch 'master' into string-gsub
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"); |
