summaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-16 16:29:11 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-16 16:29:11 +0000
commit67d00af5b6fb39189b32d7712f53326ab032040a (patch)
tree2fef8bcf0c79b10b3b163e66ffcdca995f8b160a /compile.c
parenta8be58121e378ccf273cf2e4aa7d15b7808d399e (diff)
downloadruby-67d00af5b6fb39189b32d7712f53326ab032040a.tar.gz
ruby-67d00af5b6fb39189b32d7712f53326ab032040a.tar.xz
ruby-67d00af5b6fb39189b32d7712f53326ab032040a.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@13072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/compile.c b/compile.c
index 52fae34d5..6f655c3bd 100644
--- a/compile.c
+++ b/compile.c
@@ -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;
+ }
}
}
}