* eval.c (when_check): need to splat for NODE_ARGSCAT as well.

[ruby-dev:29860]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-11-07 07:45:57 +00:00
parent 0ee03fefad
commit f54e979d36
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,8 @@
Tue Nov 7 16:41:21 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (when_check): need to splat for NODE_ARGSCAT as well.
[ruby-dev:29860]
Mon Nov 6 22:23:52 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (Init_String): remove duplicated definition of

7
eval.c
View File

@ -2723,7 +2723,9 @@ when_check(NODE *tag, VALUE val, VALUE self)
}
break;
case NODE_SPLAT:
elm = splat_value(rb_eval(self, tag->nd_head));
tag = tag->nd_head;
splat:
elm = splat_value(rb_eval(self, tag));
for (i=0; i<RARRAY_LEN(elm); i++) {
if (when_cond(val, RARRAY_PTR(elm)[i])) {
return Qtrue;
@ -2732,7 +2734,8 @@ when_check(NODE *tag, VALUE val, VALUE self)
break;
case NODE_ARGSCAT:
if (when_check(tag->nd_head, val, self)) return Qtrue;
return when_check(tag->nd_body, val, self);
tag = tag->nd_body;
goto splat;
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;