diff options
| author | Matt Valentine-House <matt@eightbitraptor.com> | 2024-01-18 14:39:32 +0000 |
|---|---|---|
| committer | Matt Valentine-House <matt@eightbitraptor.com> | 2024-01-18 20:25:28 +0000 |
| commit | 60dd731125fb540a1a222e2fcffa4fed020703fc (patch) | |
| tree | 375e46d2c22ed71a8597671018707f374aa8069f | |
| parent | 8a3e7f08b85a9a21077c420b6fa76f56899e90ee (diff) | |
[PRISM] Correct checkmatch flags for splat in rescue
| -rw-r--r-- | prism_compile.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/prism_compile.c b/prism_compile.c index 2d1dd99388..ea8c3c6387 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -5693,7 +5693,11 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, for (size_t index = 0; index < exceptions->size; index++) { ADD_GETLOCAL(ret, &dummy_line_node, LVAR_ERRINFO, 0); PM_COMPILE(exceptions->nodes[index]); - ADD_INSN1(ret, &dummy_line_node, checkmatch, INT2FIX(VM_CHECKMATCH_TYPE_RESCUE)); + int checkmatch_flags = VM_CHECKMATCH_TYPE_RESCUE; + if (PM_NODE_TYPE_P(exceptions->nodes[index], PM_SPLAT_NODE)) { + checkmatch_flags |= VM_CHECKMATCH_ARRAY; + } + ADD_INSN1(ret, &dummy_line_node, checkmatch, INT2FIX(checkmatch_flags)); ADD_INSN1(ret, &dummy_line_node, branchif, exception_match_label); } } else { |
