diff options
| author | Matt Valentine-House <matt@eightbitraptor.com> | 2024-02-08 14:57:40 +0000 |
|---|---|---|
| committer | Kevin Newton <kddnewton@gmail.com> | 2024-02-13 21:19:12 -0500 |
| commit | 0285b533e95f54866febffda108c18be329aba55 (patch) | |
| tree | e24ba46d7989d879dd8611c4deb2b9da31d6c114 | |
| parent | edb755c84b6ccbb9fed1c04aa37080d4e884a434 (diff) | |
[PRISM] Don't rb_bug if redo/break/next used during eval
| -rw-r--r-- | prism_compile.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/prism_compile.c b/prism_compile.c index 48c392ff0c..9cee340c0e 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -4442,7 +4442,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, } else if (ISEQ_BODY(ip)->type == ISEQ_TYPE_EVAL) { COMPILE_ERROR(ERROR_ARGS "Can't escape from eval with break"); - rb_bug("Can't escape from eval with break"); + return; } else { ip = ISEQ_BODY(ip)->parent_iseq; @@ -6435,7 +6435,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, break; } else if (ISEQ_BODY(ip)->type == ISEQ_TYPE_EVAL) { - rb_raise(rb_eSyntaxError, "Can't escape from eval with next"); + COMPILE_ERROR(ERROR_ARGS "Can't escape from eval with next"); return; } @@ -6651,7 +6651,8 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, break; } else if (ISEQ_BODY(ip)->type == ISEQ_TYPE_EVAL) { - rb_bug("Invalid redo\n"); + COMPILE_ERROR(ERROR_ARGS "Can't escape from eval with redo"); + return; } ip = ISEQ_BODY(ip)->parent_iseq; @@ -6663,7 +6664,8 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, PM_POP_IF_POPPED; } else { - rb_bug("Invalid redo\n"); + COMPILE_ERROR(ERROR_ARGS "Invalid redo"); + return; } } return; @@ -6871,7 +6873,7 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, PM_POP_IF_POPPED; } else { COMPILE_ERROR(ERROR_ARGS "Invalid retry"); - rb_bug("Invalid retry"); + return; } return; } |
