summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--eval.c3
-rw-r--r--parse.y4
3 files changed, 12 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 1e501ded9b..cddf55c6dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Sep 27 13:24:35 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (rb_eval): Class#inherited should be called after the
+ execution of the class body.
+
Fri Sep 27 02:41:53 2002 Akinori MUSHA <knu@iDaemons.org>
* ext/digest/sha1: Use OpenSSL's SHA1 engine if available. It is
@@ -27,6 +32,11 @@ Thu Sep 26 22:44:21 2002 Akinori MUSHA <knu@iDaemons.org>
* ext/digest/digest.c (rb_digest_base_s_hexdigest): Get rid of
redundant struct allocation.
+Thu Sep 26 09:52:52 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (primary): remove "return outside of method" check at
+ compile time.
+
Wed Sep 25 23:51:29 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* dir.c (glob_helper): must not closedir() when exception raised
diff --git a/eval.c b/eval.c
index 1bfdee87fb..3439af79ce 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;
diff --git a/parse.y b/parse.y
index 5bf5750333..56332e3125 100644
--- a/parse.y
+++ b/parse.y
@@ -556,8 +556,6 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
expr : kRETURN call_args
{
- if (!compile_for_eval && !in_def && !in_single)
- yyerror("return appeared outside of method");
$$ = NEW_RETURN(ret_args($2));
}
| kBREAK call_args
@@ -1339,8 +1337,6 @@ primary : literal
}
| kRETURN
{
- if (!compile_for_eval && !in_def && !in_single)
- yyerror("return appeared outside of method");
$$ = NEW_RETURN(0);
}
| kYIELD '(' call_args ')'