diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-01-17 15:23:59 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-01-17 15:23:59 +0000 |
commit | 13fa93f777a40e55b41f0e89c4337a21d0e06058 (patch) | |
tree | 4f6caf4150c4d0105606c1d08be816449c266c0a /marshal.c | |
parent | 292b3ecbb4a5cde9abd7ec6ed430acb30856dd78 (diff) | |
download | bundler-13fa93f777a40e55b41f0e89c4337a21d0e06058.tar.gz |
* marshal.c (class2path): check anonymous class/module before
checking referable, and allow singleton classes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r-- | marshal.c | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -105,8 +105,13 @@ class2path(klass) VALUE path = rb_class_path(klass); char *n = RSTRING(path)->ptr; - if (rb_path2class(n) != klass) { - rb_raise(rb_eArgError, "%s cannot be referred", n); + if (n[0] == '#') { + rb_raise(rb_eTypeError, "can't dump anonymous %s %s", + (TYPE(klass) == T_CLASS ? "class" : "module"), + n); + } + if (rb_path2class(n) != rb_class_real(klass)) { + rb_raise(rb_eTypeError, "%s cannot be referred", n); } return path; } @@ -531,10 +536,6 @@ w_object(obj, arg, limit) w_byte(TYPE_CLASS, arg); { VALUE path = class2path(obj); - if (RSTRING(path)->ptr[0] == '#') { - rb_raise(rb_eTypeError, "can't dump anonymous class %s", - RSTRING(path)->ptr); - } w_bytes(RSTRING(path)->ptr, RSTRING(path)->len, arg); } break; @@ -543,10 +544,6 @@ w_object(obj, arg, limit) w_byte(TYPE_MODULE, arg); { VALUE path = class2path(obj); - if (RSTRING(path)->ptr[0] == '#') { - rb_raise(rb_eTypeError, "can't dump anonymous module %s", - RSTRING(path)->ptr); - } w_bytes(RSTRING(path)->ptr, RSTRING(path)->len, arg); } break; |