From afb1901848f9b6998f320423474e830a1e95d780 Mon Sep 17 00:00:00 2001 From: ko1 Date: Fri, 15 Jun 2007 04:25:07 +0000 Subject: * hash.c: exchange semantics of Hash#each and Hash#each_pair. pointed out by [ruby-dev:30997]. * test/ruby/test_iterator.rb: ditto. * test/ruby/test_yield.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hash.c') diff --git a/hash.c b/hash.c index 3f27a0c633..d349a375c6 100644 --- a/hash.c +++ b/hash.c @@ -994,7 +994,7 @@ static int each_pair_i(VALUE key, VALUE value) { if (key == Qundef) return ST_CONTINUE; - rb_yield(rb_assoc_new(key, value)); + rb_yield_values(2, key, value); return ST_CONTINUE; } @@ -1027,7 +1027,7 @@ static int each_i(VALUE key, VALUE value) { if (key == Qundef) return ST_CONTINUE; - rb_yield_values(2, key, value); + rb_yield(rb_assoc_new(key, value)); return ST_CONTINUE; } -- cgit v1.2.3