mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* class.c, gc.c, object.c, variable.c, vm_insnhelper.c,
include/ruby/ruby.h: separate RCLASS_CONST_TBL from RCLASS_IV_TBL. RCLASS_IV_TBL has contained not only instance variable table but also constant table. Now the two table are separated to RCLASS_CONST_TBL and RCLASS_IV_TBL. This is a preparation for private constant (see [ruby-dev:39685][ruby-core:32698]). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6ca3ad34a0
commit
2285a8d813
7 changed files with 78 additions and 40 deletions
14
class.c
14
class.c
|
@ -52,6 +52,7 @@ class_alloc(VALUE flags, VALUE klass)
|
|||
OBJSETUP(obj, klass, flags);
|
||||
obj->ptr = ext;
|
||||
RCLASS_IV_TBL(obj) = 0;
|
||||
RCLASS_CONST_TBL(obj) = 0;
|
||||
RCLASS_M_TBL(obj) = 0;
|
||||
RCLASS_SUPER(obj) = 0;
|
||||
RCLASS_IV_INDEX_TBL(obj) = 0;
|
||||
|
@ -161,6 +162,12 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
|
|||
CONST_ID(id, "__classid__");
|
||||
st_delete(RCLASS_IV_TBL(clone), &id, 0);
|
||||
}
|
||||
if (RCLASS_CONST_TBL(orig)) {
|
||||
if (RCLASS_CONST_TBL(clone)) {
|
||||
st_free_table(RCLASS_CONST_TBL(clone));
|
||||
}
|
||||
RCLASS_CONST_TBL(clone) = st_copy(RCLASS_CONST_TBL(orig));
|
||||
}
|
||||
if (RCLASS_M_TBL(orig)) {
|
||||
struct clone_method_data data;
|
||||
|
||||
|
@ -216,6 +223,9 @@ rb_singleton_class_clone(VALUE obj)
|
|||
if (RCLASS_IV_TBL(klass)) {
|
||||
RCLASS_IV_TBL(clone) = st_copy(RCLASS_IV_TBL(klass));
|
||||
}
|
||||
if (RCLASS_CONST_TBL(klass)) {
|
||||
RCLASS_CONST_TBL(clone) = st_copy(RCLASS_CONST_TBL(klass));
|
||||
}
|
||||
RCLASS_M_TBL(clone) = st_init_numtable();
|
||||
data.tbl = RCLASS_M_TBL(clone);
|
||||
data.klass = (VALUE)clone;
|
||||
|
@ -607,7 +617,11 @@ include_class_new(VALUE module, VALUE super)
|
|||
if (!RCLASS_IV_TBL(module)) {
|
||||
RCLASS_IV_TBL(module) = st_init_numtable();
|
||||
}
|
||||
if (!RCLASS_CONST_TBL(module)) {
|
||||
RCLASS_CONST_TBL(module) = st_init_numtable();
|
||||
}
|
||||
RCLASS_IV_TBL(klass) = RCLASS_IV_TBL(module);
|
||||
RCLASS_CONST_TBL(klass) = RCLASS_CONST_TBL(module);
|
||||
RCLASS_M_TBL(klass) = RCLASS_M_TBL(module);
|
||||
RCLASS_SUPER(klass) = super;
|
||||
if (TYPE(module) == T_ICLASS) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue