mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
compile.c: not simple if keyword args
* compile.c (iseq_set_arguments): not a simple single argument if any keyword arguments exist. [ruby-core:55203] [Bug #8463] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
06c7ede259
commit
4a223fb67f
3 changed files with 8 additions and 2 deletions
|
@ -1,4 +1,7 @@
|
||||||
Sat Jun 1 17:21:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sat Jun 1 17:24:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* compile.c (iseq_set_arguments): not a simple single argument if any
|
||||||
|
keyword arguments exist. [ruby-core:55203] [Bug #8463]
|
||||||
|
|
||||||
* vm_insnhelper.c (vm_yield_setup_block_args): split single parameter
|
* vm_insnhelper.c (vm_yield_setup_block_args): split single parameter
|
||||||
if any keyword arguments exist, and then extract keyword arguments.
|
if any keyword arguments exist, and then extract keyword arguments.
|
||||||
|
|
|
@ -1276,7 +1276,8 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iseq->type == ISEQ_TYPE_BLOCK) {
|
if (iseq->type == ISEQ_TYPE_BLOCK) {
|
||||||
if (iseq->arg_opts == 0 && iseq->arg_post_len == 0 && iseq->arg_rest == -1) {
|
if (iseq->arg_opts == 0 && iseq->arg_post_len == 0 &&
|
||||||
|
iseq->arg_rest == -1 && iseq->arg_keyword == -1) {
|
||||||
if (iseq->argc == 1 && last_comma == 0) {
|
if (iseq->argc == 1 && last_comma == 0) {
|
||||||
/* {|a|} */
|
/* {|a|} */
|
||||||
iseq->arg_simple |= 0x02;
|
iseq->arg_simple |= 0x02;
|
||||||
|
|
|
@ -271,6 +271,8 @@ class TestKeywordArguments < Test::Unit::TestCase
|
||||||
assert_equal(expect, pr.call(expect), bug8463)
|
assert_equal(expect, pr.call(expect), bug8463)
|
||||||
pr = proc {|a, *b, **opt| next a, *b, opt}
|
pr = proc {|a, *b, **opt| next a, *b, opt}
|
||||||
assert_equal(expect, pr.call(expect), bug8463)
|
assert_equal(expect, pr.call(expect), bug8463)
|
||||||
|
pr = proc {|a, **opt| next a, opt}
|
||||||
|
assert_equal(expect.values_at(0, -1), pr.call(expect), bug8463)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_bare_kwrest
|
def test_bare_kwrest
|
||||||
|
|
Loading…
Add table
Reference in a new issue