diff options
| -rw-r--r-- | mrblib/kernel.rb | 2 | ||||
| -rw-r--r-- | src/codegen.c | 12 | ||||
| -rw-r--r-- | src/vm.c | 2 | ||||
| -rw-r--r-- | test/t/localjumperror.rb | 8 |
4 files changed, 15 insertions, 9 deletions
diff --git a/mrblib/kernel.rb b/mrblib/kernel.rb index 0277a1b83..fcfe40e3f 100644 --- a/mrblib/kernel.rb +++ b/mrblib/kernel.rb @@ -49,3 +49,5 @@ module Kernel !(self =~ y) end end + +RUBY_VERSION = "1.9" diff --git a/src/codegen.c b/src/codegen.c index 71b0c9a74..80cdb6ef1 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -2734,7 +2734,7 @@ codedump(mrb_state *mrb, mrb_irep *irep) break; case OP_LAMBDA: - printf("OP_LAMBDA\tR%d\tI(%+d)\t%d\n", GETARG_A(c), GETARG_b(c), GETARG_c(c)); + printf("OP_LAMBDA\tR%d\tI(%+d)\t%d\n", GETARG_A(c), GETARG_b(c)+1, GETARG_c(c)); break; case OP_RANGE: printf("OP_RANGE\tR%d\tR%d\t%d\n", GETARG_A(c), GETARG_B(c), GETARG_C(c)); @@ -2845,7 +2845,7 @@ codedump(mrb_state *mrb, mrb_irep *irep) mrb_sym2name(mrb, irep->syms[GETARG_B(c)])); break; case OP_EXEC: - printf("OP_EXEC\tR%d\tI(%+d)\n", GETARG_A(c), GETARG_Bx(c)); + printf("OP_EXEC\tR%d\tI(%+d)\n", GETARG_A(c), GETARG_Bx(c)+1); break; case OP_SCLASS: printf("OP_SCLASS\tR%d\tR%d\n", GETARG_A(c), GETARG_B(c)); @@ -2854,10 +2854,14 @@ codedump(mrb_state *mrb, mrb_irep *irep) printf("OP_TCLASS\tR%d\n", GETARG_A(c)); break; case OP_ERR: - printf("OP_ERR\tL(%d)\n", GETARG_Bx(c)); + { + mrb_value v = irep->pool[GETARG_Bx(c)]; + mrb_value s = mrb_str_dump(mrb, mrb_str_new(mrb, RSTRING_PTR(v), RSTRING_LEN(v))); + printf("OP_ERR\t%s\n", RSTRING_PTR(s)); + } break; case OP_EPUSH: - printf("OP_EPUSH\t:I(%+d)\n", GETARG_Bx(c)); + printf("OP_EPUSH\t:I(%+d)\n", GETARG_Bx(c)+1); break; case OP_ONERR: printf("OP_ONERR\t%03d\n", i+GETARG_sBx(c)); @@ -1350,7 +1350,7 @@ mrb_context_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int ci = mrb->c->ci; break; case OP_R_BREAK: - if (proc->env->cioff < 0) { + if (!proc->env || proc->env->cioff < 0) { localjump_error(mrb, LOCALJUMP_ERROR_BREAK); goto L_RAISE; } diff --git a/test/t/localjumperror.rb b/test/t/localjumperror.rb index a7d18b3b1..1780cb518 100644 --- a/test/t/localjumperror.rb +++ b/test/t/localjumperror.rb @@ -3,10 +3,10 @@ assert('LocalJumpError', '15.2.25') do assert_equal Class, LocalJumpError.class - assert_raise LocalJumpError do - # this will cause an exception due to the wrong location - retry - end +# assert_raise LocalJumpError do +# # this will cause an exception due to the wrong location +# retry +# end end # TODO 15.2.25.2.1 LocalJumpError#exit_value |
