summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-02-17 11:02:29 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2016-02-17 11:02:29 +0900
commitd8fc09cf927aad33138b54bc79d286ac0636cc06 (patch)
tree61696d82d69f120f3c0f07c1dda6ae30947c9276
parentec35e549adb2712ff1327d0c51502f99a38b34cc (diff)
downloadmruby-d8fc09cf927aad33138b54bc79d286ac0636cc06.tar.gz
mruby-d8fc09cf927aad33138b54bc79d286ac0636cc06.zip
push value for NULL AST when value is required; fix #3110
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index c56c1550c..12f79b893 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -1179,7 +1179,13 @@ codegen(codegen_scope *s, node *tree, int val)
{
int nt;
- if (!tree) return;
+ if (!tree) {
+ if (val) {
+ genop(s, MKOP_A(OP_LOADNIL, cursp()));
+ push();
+ }
+ return;
+ }
if (s->irep && s->filename_index != tree->filename_index) {
s->irep->filename = mrb_parser_get_filename(s->parser, s->filename_index);