[PRISM] pm_compile_logical: Fix OrNode in IfNode predicate
Fixes: https://github.com/ruby/prism/issues/2294
This commit is contained in:
parent
1142ed2f50
commit
8041b7d967
@ -495,8 +495,10 @@ pm_compile_logical(rb_iseq_t *iseq, LINK_ANCHOR *const ret, pm_node_t *cond,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!label->refcnt) {
|
if (!label->refcnt) {
|
||||||
|
if (popped) {
|
||||||
PM_PUTNIL;
|
PM_PUTNIL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
ADD_LABEL(seq, label);
|
ADD_LABEL(seq, label);
|
||||||
}
|
}
|
||||||
|
@ -1011,6 +1011,7 @@ module Prism
|
|||||||
assert_prism_eval('if ..1; end')
|
assert_prism_eval('if ..1; end')
|
||||||
assert_prism_eval('if 1..; end')
|
assert_prism_eval('if 1..; end')
|
||||||
assert_prism_eval('if 1..2; end')
|
assert_prism_eval('if 1..2; end')
|
||||||
|
assert_prism_eval('if true or true; end');
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_OrNode
|
def test_OrNode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user