* 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
This commit is contained in:
matz 2003-10-01 16:06:19 +00:00
parent 637af54751
commit f5a7147634
2 changed files with 21 additions and 12 deletions

View File

@ -1,3 +1,12 @@
Thu Oct 2 01:02:35 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* 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 <nahi@ruby-lang.org> Thu Oct 2 00:21:11 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/logger/test_logger.rb: unlinking file before close causes * test/logger/test_logger.rb: unlinking file before close causes

View File

@ -1286,7 +1286,7 @@ rb_const_get_0(klass, id, exclude, recurse)
if (!recurse && klass != rb_cObject) break; if (!recurse && klass != rb_cObject) break;
tmp = RCLASS(tmp)->super; tmp = RCLASS(tmp)->super;
} }
if (!mod_retry && BUILTIN_TYPE(klass) == T_MODULE) { if (!exclude && !mod_retry && BUILTIN_TYPE(klass) == T_MODULE) {
mod_retry = 1; mod_retry = 1;
tmp = rb_cObject; tmp = rb_cObject;
goto retry; goto retry;
@ -1316,7 +1316,7 @@ rb_const_get_at(klass, id)
VALUE klass; VALUE klass;
ID id; ID id;
{ {
return rb_const_get_0(klass, id, Qfalse, Qfalse); return rb_const_get_0(klass, id, Qtrue, Qfalse);
} }
VALUE VALUE
@ -1450,20 +1450,12 @@ rb_const_defined_0(klass, id, exclude, recurse)
return Qfalse; return Qfalse;
} }
int
rb_const_defined_at(klass, id)
VALUE klass;
ID id;
{
return rb_const_defined_0(klass, id, Qtrue, Qfalse);
}
int int
rb_const_defined_from(klass, id) rb_const_defined_from(klass, id)
VALUE klass; VALUE klass;
ID id; ID id;
{ {
return rb_const_defined_0(klass, id, Qfalse, Qtrue); return rb_const_defined_0(klass, id, Qtrue, Qtrue);
} }
int int
@ -1471,7 +1463,15 @@ rb_const_defined(klass, id)
VALUE klass; VALUE klass;
ID id; 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 static void