зеркало из https://github.com/github/ruby.git
* 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
This commit is contained in:
Родитель
292b3ecbb4
Коммит
13fa93f777
|
@ -1,3 +1,8 @@
|
|||
Sun Jan 18 00:23:55 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* marshal.c (class2path): check anonymous class/module before
|
||||
checking referable, and allow singleton classes.
|
||||
|
||||
Sat Jan 17 23:58:51 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* error.c (NameError::Message): new class for lazy evaluation of
|
||||
|
|
17
marshal.c
17
marshal.c
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче