зеркало из https://github.com/github/ruby.git
* class.c (rb_make_metaclass): [BUG] Fixed a bus error
on the case for metaclass of a class which includes a module. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6cd13d6577
Коммит
7a86a81dcc
|
@ -1,3 +1,9 @@
|
|||
Thu Sep 25 20:27:54 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
||||
|
||||
* class.c (rb_make_metaclass): [BUG] Fixed a bus error
|
||||
on the case for metaclass of a class which includes a
|
||||
module.
|
||||
|
||||
Thu Sep 25 19:34:33 2008 Eric Hodel <drbrain@segment7.net>
|
||||
|
||||
* test/rubygems/*: Update some new tests to use build_rake_in.
|
||||
|
|
9
class.c
9
class.c
|
@ -190,7 +190,7 @@ VALUE
|
|||
rb_make_metaclass(VALUE obj, VALUE super)
|
||||
{
|
||||
if (BUILTIN_TYPE(obj) == T_CLASS && FL_TEST(obj, FL_SINGLETON)) {
|
||||
VALUE metaclass;
|
||||
VALUE metaclass, meta_of_super;
|
||||
if (RBASIC(obj)->klass == obj) { /* for meta^(n)-class of Class */
|
||||
metaclass = rb_class_boot(obj);
|
||||
RBASIC(metaclass)->klass = metaclass;
|
||||
|
@ -202,7 +202,12 @@ rb_make_metaclass(VALUE obj, VALUE super)
|
|||
FL_SET(metaclass, FL_SINGLETON);
|
||||
rb_singleton_class_attached(metaclass, obj);
|
||||
RBASIC(obj)->klass = metaclass;
|
||||
RCLASS(metaclass)->ptr->super = rb_singleton_class(RCLASS(obj)->ptr->super);
|
||||
|
||||
meta_of_super = RCLASS(obj)->ptr->super;
|
||||
while (FL_TEST(meta_of_super, T_ICLASS)) {
|
||||
meta_of_super = RCLASS(meta_of_super)->ptr->super;
|
||||
}
|
||||
RCLASS(metaclass)->ptr->super = rb_singleton_class(meta_of_super);
|
||||
return metaclass;
|
||||
}
|
||||
else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче