summaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-23 15:23:12 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-23 15:23:12 +0000
commit047693b0c3db7d6b9102845f45afa186a6f3a21c (patch)
treee58a79cee393c95ac7178a869447f5b4efde5036 /compile.c
parent5b36e0bc97b758c1a9e56705804f7c4e2fc9addf (diff)
downloadruby-047693b0c3db7d6b9102845f45afa186a6f3a21c.tar.gz
ruby-047693b0c3db7d6b9102845f45afa186a6f3a21c.tar.xz
ruby-047693b0c3db7d6b9102845f45afa186a6f3a21c.zip
* compile.c (iseq_build_from_ary): initialize arg_opts, a patch from
Adam Strzelecki <ono@java.pl> in [ruby-core:17220]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index f0a35a981..d257072b1 100644
--- a/compile.c
+++ b/compile.c
@@ -5019,7 +5019,8 @@ iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
iseq->arg_post_len = FIX2INT(arg_post_len);
iseq->arg_post_start = FIX2INT(arg_post_start);
iseq->arg_block = FIX2INT(arg_block);
- iseq->arg_opt_table = (VALUE *)ALLOC_N(VALUE, RARRAY_LEN(arg_opt_labels));
+ iseq->arg_opts = RARRAY_LEN(arg_opt_labels);
+ iseq->arg_opt_table = (VALUE *)ALLOC_N(VALUE, iseq->arg_opts);
if (iseq->arg_block != -1) {
iseq->arg_size = iseq->arg_block + 1;
@@ -5031,7 +5032,7 @@ iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
iseq->arg_size = iseq->arg_rest + 1;
}
else {
- iseq->arg_size = iseq->argc + iseq->arg_opts;
+ iseq->arg_size = iseq->argc + (iseq->arg_opts ? iseq->arg_opts - 1 : 0);
}
for (i=0; i<RARRAY_LEN(arg_opt_labels); i++) {