mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm_insnhelper.c (vm_yield_setup_block_args): restores the first
arg where is overwritten at funcall. [ruby-core:24139] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a82c5ee48b
commit
918fefb7f7
4 changed files with 20 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun Jul 5 08:08:25 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm_insnhelper.c (vm_yield_setup_block_args): restores the firs
|
||||
arg where is overwritten at funcall. [ruby-core:24139]
|
||||
|
||||
Sat Jul 4 08:20:03 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* numeric.c (dbl2ival): should raise FloatDomainError on Infinity
|
||||
|
|
|
@ -747,4 +747,11 @@ class TestProc < Test::Unit::TestCase
|
|||
assert_match(/^#{ Regexp.quote(__FILE__) }$/, file)
|
||||
assert_equal(source_location_test - 1, lineno)
|
||||
end
|
||||
|
||||
def test_splat_without_respond_to
|
||||
def (obj = Object.new).respond_to?(m); false end
|
||||
[obj].each do |a, b|
|
||||
assert_equal([obj, nil], [a, b], '[ruby-core:24139]')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#define RUBY_VERSION "1.9.2"
|
||||
#define RUBY_RELEASE_DATE "2009-07-04"
|
||||
#define RUBY_RELEASE_DATE "2009-07-05"
|
||||
#define RUBY_PATCHLEVEL -1
|
||||
#define RUBY_BRANCH_NAME "trunk"
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
|||
#define RUBY_VERSION_TEENY 1
|
||||
#define RUBY_RELEASE_YEAR 2009
|
||||
#define RUBY_RELEASE_MONTH 7
|
||||
#define RUBY_RELEASE_DAY 4
|
||||
#define RUBY_RELEASE_DAY 5
|
||||
|
||||
#include "ruby/version.h"
|
||||
|
||||
|
|
|
@ -761,7 +761,7 @@ vm_yield_setup_block_args(rb_thread_t *th, const rb_iseq_t * iseq,
|
|||
int i;
|
||||
int argc = orig_argc;
|
||||
const int m = iseq->argc;
|
||||
VALUE ary;
|
||||
VALUE ary, arg0;
|
||||
rb_num_t opt_pc = 0;
|
||||
|
||||
th->mark_stack_len = argc;
|
||||
|
@ -771,15 +771,19 @@ vm_yield_setup_block_args(rb_thread_t *th, const rb_iseq_t * iseq,
|
|||
* => {|a|} => a = [1, 2]
|
||||
* => {|a, b|} => a, b = [1, 2]
|
||||
*/
|
||||
arg0 = argv[0];
|
||||
if (!(iseq->arg_simple & 0x02) && /* exclude {|a|} */
|
||||
(m + iseq->arg_post_len) > 0 && /* this process is meaningful */
|
||||
argc == 1 && !NIL_P(ary = rb_check_array_type(argv[0]))) { /* rhs is only an array */
|
||||
argc == 1 && !NIL_P(ary = rb_check_array_type(arg0))) { /* rhs is only an array */
|
||||
th->mark_stack_len = argc = RARRAY_LENINT(ary);
|
||||
|
||||
CHECK_STACK_OVERFLOW(th->cfp, argc);
|
||||
|
||||
MEMCPY(argv, RARRAY_PTR(ary), VALUE, argc);
|
||||
}
|
||||
else {
|
||||
argv[0] = arg0;
|
||||
}
|
||||
|
||||
for (i=argc; i<m; i++) {
|
||||
argv[i] = Qnil;
|
||||
|
|
Loading…
Reference in a new issue