summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-05 10:40:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-05 10:40:03 +0000
commit0c5d73e80be89a6de2aeba9556277f8740256ff9 (patch)
treebae770d394fc54884b5d924120b4fbf8856b5a8d /compile.c
parent7862695406ce7b62981ab62681b4da97a86c437a (diff)
compile.c: defined? with empty expression
* compile.c (iseq_compile_each): fix of defined? with empty expression. [ruby-core:53999] [Bug #8220] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 9360f5b791..65d01220e7 100644
--- a/compile.c
+++ b/compile.c
@@ -5175,7 +5175,12 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
case NODE_DEFINED:{
- if (!poped) {
+ if (poped) break;
+ if (!node->nd_head) {
+ VALUE str = rb_iseq_defined_string(DEFINED_NIL);
+ ADD_INSN1(ret, nd_line(node), putobject, str);
+ }
+ else {
LABEL *lfinish[2];
lfinish[0] = NEW_LABEL(line);
lfinish[1] = 0;