summaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-27 04:43:54 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-27 04:43:54 +0000
commit123387ed294aa83cc506ef7d8733b5fd042bd67f (patch)
tree01e457b0aa89e3a4c67a05d29996b89f804d4275 /compile.c
parentaa6e2791083b5ecfb4249773b99b11431e271a46 (diff)
downloadruby-123387ed294aa83cc506ef7d8733b5fd042bd67f.tar.gz
ruby-123387ed294aa83cc506ef7d8733b5fd042bd67f.tar.xz
ruby-123387ed294aa83cc506ef7d8733b5fd042bd67f.zip
* compile.c, insns.def: change return value of "defined?"
for $&, $1, ... . If such variables are defined, return "global-variable". * test/ruby/test_defined.rb: add tests. * bootstraptest/test_syntax.rb: fix a test. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 9a096ccf6..2c27d60d6 100644
--- a/compile.c
+++ b/compile.c
@@ -2333,10 +2333,12 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
needstr);
return 1;
+ case NODE_BACK_REF:
case NODE_NTH_REF:
ADD_INSN(ret, nd_line(node), putnil);
ADD_INSN3(ret, nd_line(node), defined, INT2FIX(DEFINED_REF),
- INT2FIX(node->nd_nth), needstr);
+ INT2FIX(node->nd_nth << 1 | type == NODE_BACK_REF),
+ needstr);
return 1;
case NODE_ZSUPER: