From 5cb94cde770880de0ce65bea88a6427b025938fe Mon Sep 17 00:00:00 2001 From: wanabe Date: Mon, 23 Jun 2008 15:12:29 +0000 Subject: * compile.c (iseq_build_from_ary): fix expression to obtain iseq->local_size and iseq->local_table_size. [ruby-dev:35205] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ compile.c | 10 ++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6196aba82..304440eaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Jun 24 00:10:53 2008 wanabe + * compile.c (iseq_build_from_ary): fix expression to obtain + iseq->local_size and iseq->local_table_size. [ruby-dev:35205] + Mon Jun 23 11:31:41 2008 Yukihiro Matsumoto * lib/mathn.rb (Rational::power2): removed incomplete method. diff --git a/compile.c b/compile.c index ec54bbf1d..f0a35a981 100644 --- a/compile.c +++ b/compile.c @@ -4983,22 +4983,16 @@ iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args, VALUE exception, VALUE body) { int i; - int opt = 0; ID *tbl; struct st_table *labels_table = st_init_numtable(); DECL_ANCHOR(anchor); INIT_ANCHOR(anchor); - if (iseq->type == ISEQ_TYPE_METHOD || - iseq->type == ISEQ_TYPE_TOP || - iseq->type == ISEQ_TYPE_CLASS) { - opt = 1; - } - iseq->local_table_size = opt + RARRAY_LEN(locals); + iseq->local_table_size = RARRAY_LEN(locals); iseq->local_table = tbl = (ID *)ALLOC_N(ID *, iseq->local_table_size); - iseq->local_size = opt + iseq->local_table_size; + iseq->local_size = iseq->local_table_size + 1; for (i=0; i