summaryrefslogtreecommitdiff
path: root/prism_compile.c
diff options
context:
space:
mode:
authorMatt Valentine-House <matt@eightbitraptor.com>2024-01-30 20:51:30 +0000
committerMatt Valentine-House <matt@eightbitraptor.com>2024-01-30 22:22:39 +0000
commit8041b7d9677d158850e14fc763038df30f14c16d (patch)
tree0353b5e627dc29575a4fa03cd39e5c323547a7d9 /prism_compile.c
parent1142ed2f50359d8cab7903e5cc1f0ec9a2ed3e6e (diff)
[PRISM] pm_compile_logical: Fix OrNode in IfNode predicate
Fixes: https://github.com/ruby/prism/issues/2294
Diffstat (limited to 'prism_compile.c')
-rw-r--r--prism_compile.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/prism_compile.c b/prism_compile.c
index 2bde291c38..785e971670 100644
--- a/prism_compile.c
+++ b/prism_compile.c
@@ -495,7 +495,9 @@ pm_compile_logical(rb_iseq_t *iseq, LINK_ANCHOR *const ret, pm_node_t *cond,
return;
}
if (!label->refcnt) {
- PM_PUTNIL;
+ if (popped) {
+ PM_PUTNIL;
+ }
}
else {
ADD_LABEL(seq, label);