1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
matz 2002-09-27 04:26:21 +00:00
parent 35e4d1319b
commit af181db784
3 changed files with 12 additions and 5 deletions

View file

@ -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

3
eval.c
View file

@ -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;

View file

@ -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 ')'