From ccf3fff6edb47ecb1298e7cdca6b619af136f51a Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 26 Dec 2005 08:18:33 +0000 Subject: [PATCH] * eval.c (ev_const_get): fixed a bug in constant reference during instance_eval. [yarv-dev:707] * eval.c (ev_const_defined): ditto. * lib/yaml.rb (YAML::add_domain_type): typo fixed. a patch from Joel VanderWerf . [ruby-talk:165285] [ruby-core:6995] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 +++++++++++ eval.c | 25 ++++++++++++++----------- lib/yaml.rb | 2 +- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 824a949c69..9e51946e9f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Mon Dec 26 08:50:36 2005 Yukihiro Matsumoto + + * eval.c (ev_const_get): fixed a bug in constant reference during + instance_eval. [yarv-dev:707] + + * eval.c (ev_const_defined): ditto. + + * lib/yaml.rb (YAML::add_domain_type): typo fixed. a patch from + Joel VanderWerf . + [ruby-talk:165285] [ruby-core:6995] + Sat Dec 24 18:58:14 2005 Yukihiro Matsumoto * stable version 1.8.4 released. diff --git a/eval.c b/eval.c index 82a2527148..719860a474 100644 --- a/eval.c +++ b/eval.c @@ -1810,12 +1810,13 @@ ev_const_defined(cref, id, self) while (cbase && cbase->nd_next) { struct RClass *klass = RCLASS(cbase->nd_clss); - if (NIL_P(klass)) return rb_const_defined(CLASS_OF(self), id); - if (klass->iv_tbl && st_lookup(klass->iv_tbl, id, &result)) { - if (result == Qundef && NIL_P(rb_autoload_p((VALUE)klass, id))) { - return Qfalse; + if (!NIL_P(klass)) { + if (klass->iv_tbl && st_lookup(klass->iv_tbl, id, &result)) { + if (result == Qundef && NIL_P(rb_autoload_p((VALUE)klass, id))) { + return Qfalse; + } + return Qtrue; } - return Qtrue; } cbase = cbase->nd_next; } @@ -1834,13 +1835,15 @@ ev_const_get(cref, id, self) while (cbase && cbase->nd_next) { VALUE klass = cbase->nd_clss; - if (NIL_P(klass)) return rb_const_get(CLASS_OF(self), id); - while (RCLASS(klass)->iv_tbl && st_lookup(RCLASS(klass)->iv_tbl, id, &result)) { - if (result == Qundef) { - if (!RTEST(rb_autoload_load(klass, id))) break; - continue; + if (!NIL_P(klass)) { + while (RCLASS(klass)->iv_tbl && + st_lookup(RCLASS(klass)->iv_tbl, id, &result)) { + if (result == Qundef) { + if (!RTEST(rb_autoload_load(klass, id))) break; + continue; + } + return result; } - return result; } cbase = cbase->nd_next; } diff --git a/lib/yaml.rb b/lib/yaml.rb index 3130ad115d..fe8335c8f0 100644 --- a/lib/yaml.rb +++ b/lib/yaml.rb @@ -310,7 +310,7 @@ module YAML # # Add a transfer method for a builtin type # - def YAML.add_ruby_type( type, &transfer_proc ) + def YAML.add_ruby_type( type_tag, &transfer_proc ) resolver.add_type( "tag:ruby.yaml.org,2002:#{ type_tag }", transfer_proc ) end