summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core/codegen.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-08-07 12:11:38 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-08-07 12:11:38 +0900
commit06f49b3f84e799f08a80b16054eda916f2d32819 (patch)
treea767159dee4a9105f1d7a55d8d2838bd54edbb1b /mrbgems/mruby-compiler/core/codegen.c
parentcd02cef465c12e111a308f87ee899d91774440db (diff)
downloadmruby-06f49b3f84e799f08a80b16054eda916f2d32819.tar.gz
mruby-06f49b3f84e799f08a80b16054eda916f2d32819.zip
codegen.c: need to push the value when the loop was eliminated.
Diffstat (limited to 'mrbgems/mruby-compiler/core/codegen.c')
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index e4445c1bf..a3a73fafa 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -2165,14 +2165,20 @@ codegen(codegen_scope *s, node *tree, int val)
case NODE_INT:
case NODE_STR:
if (nt == NODE_UNTIL) {
- if (val) genop_1(s, OP_LOADNIL, cursp());
+ if (val) {
+ genop_1(s, OP_LOADNIL, cursp());
+ push();
+ }
goto exit;
}
break;
case NODE_FALSE:
case NODE_NIL:
if (nt == NODE_WHILE) {
- if (val) genop_1(s, OP_LOADNIL, cursp());
+ if (val) {
+ genop_1(s, OP_LOADNIL, cursp());
+ push();
+ }
goto exit;
}
break;