* eval.c (rb_eval): fix evaluation order. [ruby-list:38431]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2003-10-05 08:56:34 +00:00
parent 12c8c18f09
commit 4aa8b47bb9
2 changed files with 20 additions and 7 deletions

View File

@ -1,3 +1,7 @@
Sun Oct 5 17:56:30 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (rb_eval): fix evaluation order. [ruby-list:38431]
Sun Oct 5 15:05:06 2003 akira yamada <akira@ruby-lang.org> Sun Oct 5 15:05:06 2003 akira yamada <akira@ruby-lang.org>
* test/uri/*: translated RUNIT to Test::Unit. * test/uri/*: translated RUNIT to Test::Unit.
@ -34,7 +38,7 @@ Sun Oct 5 11:23:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
Sun Oct 5 11:14:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org> Sun Oct 5 11:14:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
* lib/rubyunit.rb: aliasing TestCase into the top level is * lib/rubyunit.rb: aliasing TestCase into the top level is
problematic. problematic.
* lib/runit/assert.rb: fixed a couple of bugs caused by recent * lib/runit/assert.rb: fixed a couple of bugs caused by recent
refactoring in Test::Unit. refactoring in Test::Unit.

21
eval.c
View File

@ -2477,8 +2477,11 @@ rb_eval(self, n)
/* nodes for speed-up(literal match) */ /* nodes for speed-up(literal match) */
case NODE_MATCH2: case NODE_MATCH2:
result = rb_reg_match(rb_eval(self,node->nd_recv), {
rb_eval(self,node->nd_value)); VALUE l = rb_eval(self,node->nd_recv);
VALUE r = rb_eval(self,node->nd_value);
result = rb_reg_match(l, r);
}
break; break;
/* nodes for speed-up(literal match) */ /* nodes for speed-up(literal match) */
@ -2929,13 +2932,19 @@ rb_eval(self, n)
break; break;
case NODE_ARGSCAT: case NODE_ARGSCAT:
result = rb_ary_concat(rb_eval(self, node->nd_head), {
splat_value(rb_eval(self, node->nd_body))); VALUE args = rb_eval(self, node->nd_head);
result = rb_ary_concat(args,
splat_value(rb_eval(self, node->nd_body)));
}
break; break;
case NODE_ARGSPUSH: case NODE_ARGSPUSH:
result = rb_ary_push(rb_ary_dup(rb_eval(self, node->nd_head)), {
rb_eval(self, node->nd_body)); VALUE args = rb_ary_dup(rb_eval(self, node->nd_head));
result = rb_ary_push(args,
rb_eval(self, node->nd_body));
}
break; break;
case NODE_ATTRASGN: case NODE_ATTRASGN: