diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | eval.c | 3 | ||||
-rw-r--r-- | parse.y | 4 |
3 files changed, 12 insertions, 5 deletions
@@ -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 @@ -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; @@ -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 ')' |