diff options
| -rw-r--r-- | src/codegen.c | 1 | ||||
| -rw-r--r-- | src/vm.c | 10 | ||||
| -rw-r--r-- | tools/mruby/mruby.c | 1 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/codegen.c b/src/codegen.c index 2afd3a146..c6afa0184 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -2089,6 +2089,7 @@ scope_new(mrb_state *mrb, codegen_scope *prev, node *lv) if (p->filename) { p->lines = (short*)mrb_malloc(mrb, sizeof(short)*p->icapa); } + p->lineno = prev->lineno; return p; } @@ -1151,8 +1151,9 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self) int eidx; L_RAISE: + ci = mrb->ci; mrb_obj_iv_ifnone(mrb, mrb->exc, mrb_intern(mrb, "lastpc"), mrb_voidp_value(pc)); - ci = mrb->ci; + mrb_obj_iv_set(mrb, mrb->exc, mrb_intern(mrb, "ciidx"), mrb_fixnum_value(ci - mrb->cibase)); eidx = ci->eidx; if (ci == mrb->cibase) { if (ci->ridx == 0) goto L_STOP; @@ -1198,7 +1199,12 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self) localjump_error(mrb, "return"); goto L_RAISE; } - ci = mrb->ci = mrb->cibase + e->cioff; + ci = mrb->cibase + e->cioff; + if (ci == mrb->cibase) { + localjump_error(mrb, "return"); + goto L_RAISE; + } + mrb->ci = ci; break; } case OP_R_NORMAL: diff --git a/tools/mruby/mruby.c b/tools/mruby/mruby.c index 99af7bc5d..9d6182238 100644 --- a/tools/mruby/mruby.c +++ b/tools/mruby/mruby.c @@ -202,6 +202,7 @@ showcallinfo(mrb_state *mrb) } } } + if (line == -1) continue; if (ci->target_class == ci->proc->target_class) sep = "."; else |
