From f5a7147634b1369a8c0bc79d2d46e4a8285804a0 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 1 Oct 2003 16:06:19 +0000 Subject: [PATCH] * variable.c (rb_const_defined_at): should exclude constants from Object when TYPE(klass) == T_MODULE *and* exclude is on. [ruby-dev:21458] * variable.c (rb_const_get_0): do not lookup constants from Object when TYPE(klass) == T_MODULE *and* exclude is on. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 9 +++++++++ variable.c | 24 ++++++++++++------------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d08f388cf..5b1650d59d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Thu Oct 2 01:02:35 2003 Yukihiro Matsumoto + + * variable.c (rb_const_defined_at): should exclude constants from + Object when TYPE(klass) == T_MODULE *and* exclude is on. + [ruby-dev:21458] + + * variable.c (rb_const_get_0): do not lookup constants from Object + when TYPE(klass) == T_MODULE *and* exclude is on. + Thu Oct 2 00:21:11 2003 NAKAMURA, Hiroshi * test/logger/test_logger.rb: unlinking file before close causes diff --git a/variable.c b/variable.c index f2e9c7c98e..05f6281c3d 100644 --- a/variable.c +++ b/variable.c @@ -1286,7 +1286,7 @@ rb_const_get_0(klass, id, exclude, recurse) if (!recurse && klass != rb_cObject) break; tmp = RCLASS(tmp)->super; } - if (!mod_retry && BUILTIN_TYPE(klass) == T_MODULE) { + if (!exclude && !mod_retry && BUILTIN_TYPE(klass) == T_MODULE) { mod_retry = 1; tmp = rb_cObject; goto retry; @@ -1316,7 +1316,7 @@ rb_const_get_at(klass, id) VALUE klass; ID id; { - return rb_const_get_0(klass, id, Qfalse, Qfalse); + return rb_const_get_0(klass, id, Qtrue, Qfalse); } VALUE @@ -1450,20 +1450,12 @@ rb_const_defined_0(klass, id, exclude, recurse) return Qfalse; } -int -rb_const_defined_at(klass, id) - VALUE klass; - ID id; -{ - return rb_const_defined_0(klass, id, Qtrue, Qfalse); -} - int rb_const_defined_from(klass, id) VALUE klass; ID id; { - return rb_const_defined_0(klass, id, Qfalse, Qtrue); + return rb_const_defined_0(klass, id, Qtrue, Qtrue); } int @@ -1471,7 +1463,15 @@ rb_const_defined(klass, id) VALUE klass; ID id; { - return rb_const_defined_0(klass, id, Qtrue, Qtrue); + return rb_const_defined_0(klass, id, Qfalse, Qtrue); +} + +int +rb_const_defined_at(klass, id) + VALUE klass; + ID id; +{ + return rb_const_defined_0(klass, id, Qtrue, Qfalse); } static void