ruby-changes:12372
From: yugui <ko1@a...>
Date: Mon, 13 Jul 2009 15:12:55 +0900 (JST)
Subject: [ruby-changes:12372] Ruby:r24069 (ruby_1_9_1): merges r23970 from trunk into ruby_1_9_1.
yugui 2009-07-13 15:12:36 +0900 (Mon, 13 Jul 2009) New Revision: 24069 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24069 Log: merges r23970 from trunk into ruby_1_9_1. -- * proc.c (make_curry_proc): should propagate lambda-ness. [ruby-core:24127] Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/proc.c branches/ruby_1_9_1/test/ruby/test_proc.rb branches/ruby_1_9_1/version.h Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 24068) +++ ruby_1_9_1/ChangeLog (revision 24069) @@ -1,3 +1,8 @@ +Mon Jul 6 09:31:50 2009 Nobuyoshi Nakada <nobu@r...> + + * proc.c (make_curry_proc): should propagate lambda-ness. + [ruby-core:24127] + Sun Jul 5 14:04:36 2009 Nobuyoshi Nakada <nobu@r...> * thread.c (rb_threadptr_exec_event_hooks): new function to Index: ruby_1_9_1/proc.c =================================================================== --- ruby_1_9_1/proc.c (revision 24068) +++ ruby_1_9_1/proc.c (revision 24069) @@ -1694,9 +1694,17 @@ make_curry_proc(VALUE proc, VALUE passed, VALUE arity) { VALUE args = rb_ary_new3(3, proc, passed, arity); + rb_proc_t *procp; + int is_lambda; + + GetProcPtr(proc, procp); + is_lambda = procp->is_lambda; rb_ary_freeze(passed); rb_ary_freeze(args); - return rb_proc_new(curry, args); + proc = rb_proc_new(curry, args); + GetProcPtr(proc, procp); + procp->is_lambda = is_lambda; + return proc; } static VALUE @@ -1710,7 +1718,7 @@ passed = rb_ary_plus(passed, rb_ary_new4(argc, argv)); rb_ary_freeze(passed); - if(RARRAY_LEN(passed) < FIX2INT(arity)) { + if (RARRAY_LEN(passed) < FIX2INT(arity)) { if (!NIL_P(passed_proc)) { rb_warn("given block not used"); } Index: ruby_1_9_1/version.h =================================================================== --- ruby_1_9_1/version.h (revision 24068) +++ ruby_1_9_1/version.h (revision 24069) @@ -1,6 +1,6 @@ #define RUBY_VERSION "1.9.1" #define RUBY_RELEASE_DATE "2009-07-12" -#define RUBY_PATCHLEVEL 219 +#define RUBY_PATCHLEVEL 220 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 Index: ruby_1_9_1/test/ruby/test_proc.rb =================================================================== --- ruby_1_9_1/test/ruby/test_proc.rb (revision 24068) +++ ruby_1_9_1/test/ruby/test_proc.rb (revision 24069) @@ -176,6 +176,18 @@ b = proc { :foo } assert_equal(:foo, b.curry[]) + + b = lambda {|x, y, &b| b.call(x + y) }.curry + b = b.call(2) { raise } + b = b.call(3) {|x| x + 4 } + assert_equal(9, b) + + l = proc {} + assert_equal(false, l.lambda?) + assert_equal(false, l.curry.lambda?, '[ruby-core:24127]') + l = lambda {} + assert_equal(true, l.lambda?) + assert_equal(true, l.curry.lambda?, '[ruby-core:24127]') end def test_curry_ski_fib -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/