e$B$J$+$@$G$9!#e(B
e$B0JA0$A$g$C$HDs0F$7$?3P$($,$"$j$^$9$,!"e(Brescuee$BF1MMe(Bwhene$B$NHf3S7k2Le(B
e$B$rJQ?t$KBeF~$9$k9=J8$O$I$&$G$7$g$&$+!#e(BRegexp#===e$B$NLa$jCM$be(B
MatchDatae$B$K$9$k$3$H$G!"e(B$~e$B$r;H$&I,MW$r8:$i$;$k$H;W$$$^$9!#e(B
Index: eval.c
RCS file: /cvs/ruby/src/ruby/eval.c,v
retrieving revision 1.945
diff -p -u -2 -r1.945 eval.c
— eval.c 10 Sep 2006 00:18:18 -0000 1.945
+++ eval.c 12 Sep 2006 23:53:08 -0000
@@ -2686,14 +2686,15 @@ unknown_node(NODE *volatile node)
static int
-when_cond(VALUE v1, VALUE v2)
+when_cond(VALUE v1, VALUE v2, volatile VALUE *result)
{
- if (v1 == Qundef) {
- return RTEST(v2);
- if (v1 != Qundef) {
- v2 = rb_funcall2(v2, eqq, 1, &v1);
}
- return RTEST(rb_funcall2(v2, eqq, 1, &v1));
- *result = v2;
- return RTEST(v2);
}
static int
-when_check(NODE *tag, VALUE val, VALUE self)
+when_check(NODE *tag, VALUE val, VALUE self, volatile VALUE *result)
{
VALUE elm;
@@ -2704,5 +2705,5 @@ when_check(NODE *tag, VALUE val, VALUE s
while (tag) {
elm = rb_eval(self, tag->nd_head);
-
if (when_cond(val, elm)) {
-
if (when_cond(val, elm, result)) { return Qtrue; }
@@ -2713,5 +2714,5 @@ when_check(NODE *tag, VALUE val, VALUE s
elm = svalue_to_avalue(rb_eval(self, tag->nd_head));
for (i=0; i<RARRAY_LEN(elm); i++) {
-
if (when_cond(val, RARRAY_PTR(elm)[i])) {
-
if (when_cond(val, RARRAY_PTR(elm)[i], result)) { return Qtrue; }
@@ -2719,11 +2720,11 @@ when_check(NODE *tag, VALUE val, VALUE s
break;
case NODE_ARGSCAT:
- if (when_check(tag->nd_head, val, self)) return Qtrue;
- return when_check(tag->nd_body, val, self);
- if (when_check(tag->nd_head, val, self, result)) return Qtrue;
- return when_check(tag->nd_body, val, self, result);
case NODE_ARGSPUSH:
- if (when_check(tag->nd_head, val, self)) return Qtrue;
- if (when_cond(val, rb_eval(self, tag->nd_body))) return Qtrue;
- if (when_check(tag->nd_head, val, self, result)) return Qtrue;
- if (when_cond(val, rb_eval(self, tag->nd_body), result)) return Qtrue;
default:
- if (when_cond(val, rb_eval(self, tag))) return Qtrue;
- if (when_cond(val, rb_eval(self, tag), result)) return Qtrue;
break;
}
@@ -2874,5 +2875,8 @@ rb_eval(VALUE self, NODE *n)
ruby_frame->this_func,
ruby_frame->this_class);
-
if (when_check(node->nd_head, val, self)) {
-
if (when_check(node->nd_head->nd_cond, val, self, &result)) {
-
if (node->nd_head->nd_body) {
-
assign(self, node->nd_head->nd_body, result, Qfalse);
-
} node = node->nd_body; goto again;
Index: parse.y
RCS file: /cvs/ruby/src/ruby/parse.y,v
retrieving revision 1.458
diff -p -u -2 -r1.458 parse.y
— parse.y 6 Sep 2006 04:25:53 -0000 1.458
+++ parse.y 12 Sep 2006 23:44:31 -0000
@@ -3392,12 +3392,12 @@ brace_block : ‘{’
;
-case_body : keyword_when args then
+case_body : keyword_when args exc_var then
compstmt
cases
{
/%%%/
-
$$ = NEW_WHEN($2, $4, $5);
-
$$ = NEW_WHEN(NEW_IF($2, $3, 0), $5, $6); /*%
-
$$ = dispatch3(when, $2, $4, escape_Qundef($5));
-
$$ = dispatch4(when, $2, $3, $5, escape_Qundef($6)); %*/ }
Index: re.c
RCS file: /cvs/ruby/src/ruby/re.c,v
retrieving revision 1.154
diff -p -U 2 -r1.154 re.c
— re.c 31 Aug 2006 10:47:43 -0000 1.154
+++ re.c 12 Sep 2006 23:57:05 -0000
@@ -1658,7 +1658,7 @@ rb_reg_eqq(VALUE re, VALUE str)
start = rb_reg_search(re, str, 0, 0);
if (start < 0) {
- return Qfalse;
- return Qnil;
}
- return Qtrue;
- return rb_backref_get();
}