diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-09-25 07:03:05 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-09-25 07:03:05 +0000 |
commit | 4b9a7eac05e10555d3ee700e5c4c7a1c6938c279 (patch) | |
tree | be5c55e74362ec058e7350d490fa375f3abd2f04 /class.c | |
parent | 8a1e574cdbd7a02692bc6bca8ba9a5690b6ecf10 (diff) | |
download | ruby-4b9a7eac05e10555d3ee700e5c4c7a1c6938c279.tar.gz |
* io.c (appendline): forget to terminate with nul.
* eval.c (ruby_run): should set toplevel visibility again here.
* eval.c (rb_eval): should not rely on ruby_class == rb_cObject
check. Besides allow implicit publicity for attribute set
methods.
* parse.y (primary): need not to check class_nest, just set
whether method is an attrset or not.
* string.c (rb_str_each_line): p might be at the top of the
string.
* class.c (rb_make_metaclass): class of metaclass should be
metaclass of superclass, unless class itself is a metaclass;
class of metaclass of metaclass should point back to self.
eh, confusing, isn't it.
* class.c (rb_singleton_class): check if its class is singleton
AND attached to self.
* eval.c (rb_eval): should define class/module under ruby_cbase.
* eval.c (rb_eval): should set class/module path based on
ruby_cbase, not ruby_class.
* eval.c (module_setup): use ruby_cbase instead of ruby_class.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r-- | class.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -147,11 +147,12 @@ rb_make_metaclass(obj, super) FL_SET(klass, FL_SINGLETON); RBASIC(obj)->klass = klass; rb_singleton_class_attached(klass, obj); - if (BUILTIN_TYPE(obj) == T_CLASS) { + if (BUILTIN_TYPE(obj) == T_CLASS && FL_TEST(obj, FL_SINGLETON)) { RBASIC(klass)->klass = klass; - if (FL_TEST(obj, FL_SINGLETON)) { - RCLASS(klass)->super = RBASIC(rb_class_real(RCLASS(obj)->super))->klass; - } + RCLASS(klass)->super = RBASIC(rb_class_real(RCLASS(obj)->super))->klass; + } + else { + RBASIC(klass)->klass = RBASIC(rb_class_real(super))->klass; } return klass; @@ -699,8 +700,7 @@ rb_singleton_class(obj) DEFER_INTS; if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON) && - (BUILTIN_TYPE(obj) == T_CLASS || /* metaclass (or metaclass of metaclass) */ - rb_iv_get(RBASIC(obj)->klass, "__attached__") == obj)) { + rb_iv_get(RBASIC(obj)->klass, "__attached__") == obj) { klass = RBASIC(obj)->klass; } else { |