diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-16 16:29:11 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-16 16:29:11 +0000 |
commit | fc466622fd220b1d907d86cdbc3f74acc11a58ca (patch) | |
tree | 2fef8bcf0c79b10b3b163e66ffcdca995f8b160a /compile.c | |
parent | 4657257b75ff1d88e2653e4c408b0d98e7fbdc9a (diff) | |
download | ruby-fc466622fd220b1d907d86cdbc3f74acc11a58ca.tar.gz |
* compile.c (iseq_set_arguments), insnhelper.ci
(vm_callee_setup_arg, vm_yield_setup_args): fix
block parameter problems. [ruby-dev:31437], [ruby-dev:31440]
* bootstraptest/test_block.rb: add a test of [ruby-dev:31440].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -881,7 +881,7 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args) /* set arg_size: size of arguments */ if (iseq->arg_block != -1) { iseq->arg_size = iseq->arg_block + 1; - } + } else if (iseq->arg_post_len) { iseq->arg_size = iseq->arg_post_start + iseq->arg_post_len; } @@ -891,7 +891,7 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args) else if (iseq->arg_opts) { iseq->arg_size = iseq->argc + iseq->arg_opts - 1; } - else { + else { iseq->arg_size = iseq->argc; } } @@ -901,9 +901,11 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args) } if (iseq->type == ISEQ_TYPE_BLOCK) { - if (iseq->argc == 1 && iseq->arg_simple == 1 && last_comma == 0) { - /* {|a|} */ - iseq->arg_simple = 2; + if (iseq->arg_opts == 0 && iseq->arg_post_len == 0 && iseq->arg_rest == -1) { + if (iseq->argc == 1 && last_comma == 0) { + /* {|a|} */ + iseq->arg_simple = 2; + } } } } |