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): should handle when in else clause. a patch

from Eric Hodel <drbrain at segment7.net>.  [ruby-core:08662]

* parse.y (primary): wrap with NODE_CASE.  [ruby-core:08663]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-09-02 14:36:22 +00:00
parent 965b0d3807
commit 8581164ea6
3 changed files with 11 additions and 17 deletions

View file

@ -15,6 +15,13 @@ Sat Sep 2 12:00:32 2006 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
instead of String#[](idx) to check utf BOM. follows String#[](idx)
behavior change of 1.9.
Sat Sep 2 11:47:58 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_eval): should handle when in else clause. a patch
from Eric Hodel <drbrain at segment7.net>. [ruby-core:08662]
* parse.y (primary): wrap with NODE_CASE. [ruby-core:08663]
Fri Sep 1 22:07:04 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* ruby.h (RSTRING_EMBED_LEN_MASK): uses 5 bits to support 64bit

19
eval.c
View file

@ -2861,25 +2861,12 @@ rb_eval(VALUE self, NODE *n)
}
goto again;
case NODE_WHEN:
while (node) {
if (nd_type(node) != NODE_WHEN) goto again;
EXEC_EVENT_HOOK(RUBY_EVENT_LINE, node->nd_head, self,
ruby_frame->this_func,
ruby_frame->this_class);
if (when_check(node->nd_head, Qundef, self)) {
node = node->nd_body;
goto again;
}
node = node->nd_next;
}
RETURN(Qnil);
case NODE_CASE:
{
VALUE val;
VALUE val = Qundef;
val = rb_eval(self, node->nd_head);
if (node->nd_head)
val = rb_eval(self, node->nd_head);
node = node->nd_body;
while (node) {
if (nd_type(node) != NODE_WHEN) {

View file

@ -2605,7 +2605,7 @@ primary : literal
| keyword_case opt_terms case_body keyword_end
{
/*%%%*/
$$ = $3;
$$ = NEW_CASE(0, $3);
/*%
$$ = dispatch2(case, Qnil, $3);
%*/