summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 8e1ac27c51..50ca9902fd 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1809,7 +1809,16 @@ vm_throw_start(const rb_execution_context_t *ec, rb_control_frame_t *const reg_c
}
}
break;
- case ISEQ_TYPE_EVAL:
+ case ISEQ_TYPE_EVAL: {
+ const rb_iseq_t *is = escape_cfp->iseq;
+ enum rb_iseq_type t = ISEQ_BODY(is)->type;
+ while (t == ISEQ_TYPE_RESCUE || t == ISEQ_TYPE_ENSURE || t == ISEQ_TYPE_EVAL) {
+ if (!(is = ISEQ_BODY(is)->parent_iseq)) break;
+ t = ISEQ_BODY(is)->type;
+ }
+ toplevel = t == ISEQ_TYPE_TOP || t == ISEQ_TYPE_MAIN;
+ break;
+ }
case ISEQ_TYPE_CLASS:
toplevel = 0;
break;