summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-27 04:26:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-09-27 04:26:21 +0000
commitaf181db7846b3ca38b443bdf7d65e6d26f87da6a (patch)
tree9c05af34210f699bd1425b5ff6f5b2e39919f2af /eval.c
parent35e4d1319b86f9a2899a0fc1bb6ffafd7f26840e (diff)
* eval.c (rb_eval): Class#inherited should be called after the
execution of the class body. * parse.y (primary): remove "return outside of method" check at compile time. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index 1bfdee8..3439af7 100644
--- a/eval.c
+++ b/eval.c
@@ -3281,6 +3281,7 @@ rb_eval(self, n)
if (tmp != super) {
goto override_class;
}
+ super = 0;
}
if (ruby_safe_level >= 4) {
rb_raise(rb_eSecurityError, "extending class prohibited");
@@ -3291,7 +3292,6 @@ rb_eval(self, n)
if (!super) super = rb_cObject;
klass = rb_define_class_id(node->nd_cname, super);
rb_set_class_path(klass,ruby_cbase,rb_id2name(node->nd_cname));
- rb_class_inherited(super, klass);
rb_const_set(ruby_cbase, node->nd_cname, klass);
}
if (ruby_wrapper) {
@@ -3300,6 +3300,7 @@ rb_eval(self, n)
}
result = module_setup(klass, node->nd_body);
+ if (super) rb_class_inherited(super, klass);
}
break;