summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-10-22 06:48:18 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-10-22 06:48:18 +0000
commit959d5febcf0cdd2f4d81a1bb91bcd8d9fee83f2f (patch)
tree2a3fe02c8a124b8e603ac1e2aa1690dc5c322885 /marshal.c
parentd0129370f07f3fcdcb18b9788161abdbbf230325 (diff)
* class.c (rb_mod_clone): should not copy class name, since clone
should remain anonymous. * eval.c (rb_call0): self in a block given to define_method now be switched to the receiver of the method. * eval.c (proc_invoke): added new parameter to allow self switching. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/marshal.c b/marshal.c
index bbc953d..6d0b2bc 100644
--- a/marshal.c
+++ b/marshal.c
@@ -247,7 +247,7 @@ w_uclass(obj, klass, arg)
VALUE obj, klass;
struct dump_arg *arg;
{
- if (rb_class_real(CLASS_OF(obj)) != klass) {
+ if (rb_obj_class(obj) != klass) {
w_byte(TYPE_UCLASS, arg);
w_unique(rb_class2name(CLASS_OF(obj)), arg);
}
@@ -799,20 +799,17 @@ r_object(arg)
case TYPE_UCLASS:
{
VALUE c = rb_path2class(r_unique(arg));
- VALUE tmp;
v = r_object(arg);
- if (rb_special_const_p(v) ||
- TYPE(v) == T_OBJECT || TYPE(v) == T_CLASS || TYPE(v) == T_MODULE ||
- !RTEST(rb_funcall(c, '<', 1, RBASIC(v)->klass))) {
+ if (rb_special_const_p(v) || TYPE(v) == T_OBJECT || TYPE(v) == T_CLASS) {
+ format_error:
rb_raise(rb_eArgError, "dump format error (user class)");
}
-#if 0
- tmp = rb_obj_alloc(c);
- if (TYPE(v) != TYPE(tmp)) {
- rb_raise(rb_eArgError, "dump format error (user class)");
+ if (TYPE(v) == T_MODULE || !RTEST(rb_funcall(c, '<', 1, RBASIC(v)->klass))) {
+ VALUE tmp = rb_obj_alloc(c);
+
+ if (TYPE(v) != TYPE(tmp)) goto format_error;
}
-#endif
RBASIC(v)->klass = c;
return v;
}