diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2024-09-27 13:06:27 -0400 |
|---|---|---|
| committer | Kevin Newton <kddnewton@gmail.com> | 2024-09-27 13:43:37 -0400 |
| commit | addb5fea94ea4011fe7d593ee3c59d6d07803839 (patch) | |
| tree | 1c93746e4058205b137a565ec99d25ce56a28d2f | |
| parent | 7e19904c88fde024051333dfbd534b9fd3b26bf9 (diff) | |
Fix up compiling popped ranges with non-optimizable bounds
Fixes [Bug #20763]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11714
| -rw-r--r-- | prism_compile.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/prism_compile.c b/prism_compile.c index 22956fa5e3..a159267da3 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -9678,19 +9678,19 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, } } else { - if (cast->left == NULL) { - PUSH_INSN(ret, location, putnil); - } - else { + if (cast->left != NULL) { PM_COMPILE(cast->left); } - - if (cast->right == NULL) { + else if (!popped) { PUSH_INSN(ret, location, putnil); } - else { + + if (cast->right != NULL) { PM_COMPILE(cast->right); } + else if (!popped) { + PUSH_INSN(ret, location, putnil); + } if (!popped) { PUSH_INSN1(ret, location, newrange, INT2FIX(exclude_end ? 1 : 0)); |
