summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-01 01:36:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-01 01:36:25 +0000
commit442c836bfe7396f81a0f1f2f8daeeeabbf0d0343 (patch)
treef5366b3fb371e3a294c4d3dc6559e7bc772c4f94 /variable.c
parent7bb1e40d8b5928a7d3740b72f02f6a5d5fb0d21b (diff)
* class.c (rb_define_class, rb_define_module): also set constant under
Object. [ruby-dev:20445] * object.c (boot_defclass): ditto. * variable.c (rb_const_get_at, rb_const_get_0, rb_mod_const_at, rb_const_defined, mod_av_set, rb_const_assign): toplevel constants are now under Object, rb_class_tbl remains for GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/variable.c b/variable.c
index eb1f3e3..fcbc8cc 100644
--- a/variable.c
+++ b/variable.c
@@ -1254,16 +1254,6 @@ rb_autoload_p(mod, id)
return autoload_file(mod, id);
}
-static int
-top_const_get(id, klassp)
- ID id;
- VALUE *klassp;
-{
- /* pre-defined class */
- if (st_lookup(rb_class_tbl, id, klassp)) return Qtrue;
- return Qfalse;
-}
-
VALUE
rb_const_get_at(klass, id)
VALUE klass;
@@ -1278,9 +1268,6 @@ rb_const_get_at(klass, id)
}
return value;
}
- if (klass == rb_cObject && top_const_get(id, &value)) {
- return value;
- }
uninitialized_constant(klass, id);
return Qnil; /* not reached */
}
@@ -1308,7 +1295,6 @@ rb_const_get_0(klass, id, exclude)
}
return value;
}
- if (tmp == rb_cObject && top_const_get(id, &value)) return value;
tmp = RCLASS(tmp)->super;
}
if (!mod_retry && BUILTIN_TYPE(klass) == T_MODULE) {
@@ -1393,9 +1379,6 @@ rb_mod_const_at(mod, data)
if (RCLASS(mod)->iv_tbl) {
st_foreach(RCLASS(mod)->iv_tbl, sv_i, (st_data_t)tbl);
}
- if ((VALUE)mod == rb_cObject) {
- st_foreach(rb_class_tbl, sv_i, (st_data_t)tbl);
- }
return tbl;
}
@@ -1500,8 +1483,6 @@ rb_const_defined(klass, id)
if (BUILTIN_TYPE(klass) == T_MODULE) {
return rb_const_defined(rb_cObject, id);
}
- if (st_lookup(rb_class_tbl, id, 0))
- return Qtrue;
return Qfalse;
}
@@ -1523,8 +1504,7 @@ mod_av_set(klass, id, val, isconst)
else if (isconst) {
VALUE value = Qfalse;
- if (st_lookup(RCLASS(klass)->iv_tbl, id, &value) ||
- (klass == rb_cObject && st_lookup(rb_class_tbl, id, 0))) {
+ if (st_lookup(RCLASS(klass)->iv_tbl, id, &value)) {
if (value == Qundef)
autoload_delete(klass, id);
else
@@ -1559,12 +1539,6 @@ rb_const_assign(klass, id, val)
}
tmp = RCLASS(tmp)->super;
}
- /* pre-defined class */
- if (st_lookup(rb_class_tbl, id, 0)) {
- st_delete(rb_class_tbl, &id, 0);
- st_insert(RCLASS(rb_cObject)->iv_tbl, id, val);
- return;
- }
uninitialized_constant(klass, id);
}