summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-08-20 07:19:43 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2019-08-20 22:01:50 +0900
commit183fb961b313ab5dc6bcb15c952c34a1aa842fb7 (patch)
tree6f777d17e5f01014f1f64460af70578175a690d7
parent942c076938e86cad1dba8f63a123cfac748b9175 (diff)
downloadmruby-183fb961b313ab5dc6bcb15c952c34a1aa842fb7.tar.gz
mruby-183fb961b313ab5dc6bcb15c952c34a1aa842fb7.zip
Fixed a bug in the `OP_JMPNOT` optimization (13eaff4); fix #4644
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index 36367f656..d397ace8c 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -1578,7 +1578,7 @@ codegen(codegen_scope *s, node *tree, int val)
}
codegen(s, tree->car, VAL);
pop();
- if (tree->cdr->car) {
+ if (val || tree->cdr->car) {
pos1 = genjmp2(s, OP_JMPNOT, cursp(), 0, val);
codegen(s, tree->cdr->car, val);
if (elsepart) {