summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-10-19 23:04:20 +0900
committerYukihiro Matsumoto <[email protected]>2012-10-19 23:04:20 +0900
commit651e8b7e9c513cda100d88216d54ceeb93234f65 (patch)
tree62a5668ecc482a05b9e15b584f0043fa8e60512d /src
parent48550047112bd66e097e4ad0203ddeb2978fc133 (diff)
downloadmruby-651e8b7e9c513cda100d88216d54ceeb93234f65.tar.gz
mruby-651e8b7e9c513cda100d88216d54ceeb93234f65.zip
empty NODE_BEGIN should push nil; close #496
Diffstat (limited to 'src')
-rw-r--r--src/codegen.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/codegen.c b/src/codegen.c
index 27f217ebe..d42a099c8 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -951,6 +951,10 @@ codegen(codegen_scope *s, node *tree, int val)
tree = tree->cdr;
switch (nt) {
case NODE_BEGIN:
+ if (val && !tree) {
+ genop(s, MKOP_A(OP_LOADNIL, cursp()));
+ push();
+ }
while (tree) {
codegen(s, tree->car, tree->cdr ? NOVAL : val);
tree = tree->cdr;