diff options
| author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-27 04:43:54 +0000 |
|---|---|---|
| committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-27 04:43:54 +0000 |
| commit | 123387ed294aa83cc506ef7d8733b5fd042bd67f (patch) | |
| tree | 01e457b0aa89e3a4c67a05d29996b89f804d4275 /insns.def | |
| parent | aa6e2791083b5ecfb4249773b99b11431e271a46 (diff) | |
| download | ruby-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 'insns.def')
| -rw-r--r-- | insns.def | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -795,8 +795,6 @@ defined { VALUE klass; char *expr_type = 0; - char buf[0x10]; - val = Qnil; switch (type) { @@ -868,12 +866,9 @@ defined break; } case DEFINED_REF:{ - int nth = FIX2INT(obj); - VALUE backref = lfp_svar_get(th, GET_LFP(), 1); - - if (rb_reg_nth_match(nth, backref) != Qnil) { - snprintf(buf, 0x10, "$%d", nth); - expr_type = buf; + val = vm_getspecial(th, GET_LFP(), Qfalse, FIX2INT(obj)); + if (val != Qnil) { + expr_type = "global-variable"; } break; } |
