* class.c (rb_make_metaclass): Made class of class of class

from Class into its own eigenclass. Now meta^(n)-class
  hierarchy regresses infinitely, again.
  (This feature was decided on developer-meeting-20080922.)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yugui 2008-09-25 09:46:59 +00:00
Родитель faefcc8249
Коммит 788001a9c8
2 изменённых файлов: 26 добавлений и 6 удалений

Просмотреть файл

@ -1,10 +1,17 @@
2008-09-25 Jim Weirich <jim@tardis.local>
Thu Sep 25 18:40:42 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* class.c (rb_make_metaclass): Made class of class of class
from Class into its own eigenclass. Now meta^(n)-class
hierarchy regresses infinitely, again.
(This feature was decided on developer-meeting-20080922.)
Thu Sep 25 16:01:07 2008 Jim Weirich <jim@tardis.local>
* lib/rake.rb: Update rake source to version 0.8.3. This
version includes some fixes for running Rake on windows. (1)
better APPDATA/HOMExxx/USERPROFILE integration for system
rakefiles, (2) Better handling of the :ruby command when
installed in directory containing spaces.
version includes some fixes for running Rake on windows.
(1) better APPDATA/HOMExxx/USERPROFILE integration for
system rakefiles, (2) Better handling of the :ruby command
when installed in directory containing spaces.
Thu Sep 25 11:22:51 2008

15
class.c
Просмотреть файл

@ -190,7 +190,20 @@ VALUE
rb_make_metaclass(VALUE obj, VALUE super)
{
if (BUILTIN_TYPE(obj) == T_CLASS && FL_TEST(obj, FL_SINGLETON)) {
return RBASIC(obj)->klass = rb_cClass;
VALUE metaclass;
if (RBASIC(obj)->klass == obj) { /* for meta^(n)-class of Class */
metaclass = rb_class_boot(obj);
RBASIC(metaclass)->klass = metaclass;
}
else {
metaclass = rb_class_boot(super);
RBASIC(metaclass)->klass = rb_singleton_class(RBASIC(obj)->klass);
}
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);
return metaclass;
}
else {
VALUE metasuper;