summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-22 08:29:58 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-22 08:29:58 +0000
commit44cf56d6e70dbe06a160b004494ba40dd4cfb426 (patch)
tree10e665c60414c3070ce957e5c534e30ed499bc2d /object.c
parent4b4cad81e7d2bdc4750ea5043ce44bf37adb3997 (diff)
2000-06-22
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/object.c b/object.c
index 410c964..b9333f7 100644
--- a/object.c
+++ b/object.c
@@ -113,10 +113,14 @@ static VALUE
rb_obj_dup(obj)
VALUE obj;
{
- VALUE dup;
-
if (TYPE(obj) == T_OBJECT) {
- dup = rb_obj_alloc(RBASIC(obj)->klass);
+ VALUE klass = CLASS_OF(obj);
+ VALUE dup;
+
+ while (TYPE(klass) == T_ICLASS || FL_TEST(klass, FL_SINGLETON)) {
+ klass = (VALUE)RCLASS(klass)->super;
+ }
+ dup = rb_obj_alloc(klass);
if (ROBJECT(obj)->iv_tbl) {
ROBJECT(dup)->iv_tbl = st_copy(ROBJECT(obj)->iv_tbl);
}