summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'object.c')
-rw-r--r--object.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/object.c b/object.c
index 2d70029f0b6..e34bb23b1b5 100644
--- a/object.c
+++ b/object.c
@@ -70,12 +70,10 @@ rb_obj_id(obj)
return (VALUE)((long)obj|FIXNUM_FLAG);
}
-static VALUE
-rb_obj_type(obj)
- VALUE obj;
+VALUE
+rb_class_real(cl)
+ VALUE cl;
{
- VALUE cl = CLASS_OF(obj);
-
while (FL_TEST(cl, FL_SINGLETON) || TYPE(cl) == T_ICLASS) {
cl = RCLASS(cl)->super;
}
@@ -83,6 +81,13 @@ rb_obj_type(obj)
}
VALUE
+rb_obj_type(obj)
+ VALUE obj;
+{
+ return rb_class_real(CLASS_OF(obj));
+}
+
+VALUE
rb_obj_clone(obj)
VALUE obj;
{
@@ -113,6 +118,9 @@ rb_obj_dup(obj)
if (!SPECIAL_CONST_P(dup)) {
OBJSETUP(dup, rb_obj_type(obj), BUILTIN_TYPE(obj));
OBJ_INFECT(dup, obj);
+ if (FL_TEST(obj, FL_EXIVAR)) {
+ FL_SET(dup, FL_EXIVAR);
+ }
}
return dup;
}
@@ -866,7 +874,7 @@ rb_convert_type(val, type, tname, method)
arg1.val = arg2.val = val;
arg1.s = method;
arg2.s = tname;
- val = rb_rescue2(to_type, (VALUE)&arg1, fail_to_type, (VALUE)&arg2);
+ val = rb_rescue(to_type, (VALUE)&arg1, fail_to_type, (VALUE)&arg2);
if (TYPE(val) != type) {
rb_raise(rb_eTypeError, "%s#%s should return %s",
rb_class2name(CLASS_OF(arg1.val)), method, tname);