summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/codegen.c2
-rw-r--r--src/vm.c8
2 files changed, 8 insertions, 2 deletions
diff --git a/src/codegen.c b/src/codegen.c
index 19a5835fa..2482209cc 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -911,7 +911,7 @@ raise_error(codegen_scope *s, const char *msg)
{
int idx = new_lit(s, mrb_str_new_cstr(s->mrb, msg));
- genop(s, MKOP_ABx(OP_ERR, 0, idx));
+ genop(s, MKOP_ABx(OP_ERR, 1, idx));
}
static double
diff --git a/src/vm.c b/src/vm.c
index a779565be..a68d089cc 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -1817,8 +1817,14 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
CASE(OP_ERR) {
/* Bx raise RuntimeError with message Lit(Bx) */
mrb_value msg = pool[GETARG_Bx(i)];
- mrb_value exc = mrb_exc_new3(mrb, E_RUNTIME_ERROR, msg);
+ mrb_value exc;
+ if (GETARG_A(i) == 0) {
+ exc = mrb_exc_new3(mrb, E_RUNTIME_ERROR, msg);
+ }
+ else {
+ exc = mrb_exc_new3(mrb, E_LOCALJUMP_ERROR, msg);
+ }
mrb->exc = (struct RObject*)mrb_object(exc);
goto L_RAISE;
}