From a5e89ea4e76e4e169162cab2959c4c6e1214d212 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sun, 24 Mar 2013 15:47:22 +0000 Subject: merge revision(s) 39536: [Backport #7989] * iseq.c (iseq_data_to_ary): fix condition. r34303 introduces a bug to avoid all line information from a result of ISeq#to_a. This is a regression problem from 2.0.0p0. * test/ruby/test_iseq.rb: add a test of lines after ISeq#to_a. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@39910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ iseq.c | 2 +- test/ruby/test_iseq.rb | 12 ++++++++++++ version.h | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a0441f2789..1f1ab0e030 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Mon Mar 25 00:47:04 2013 Koichi Sasada + + * iseq.c (iseq_data_to_ary): fix condition. + r34303 introduces a bug to avoid all line information from + a result of ISeq#to_a. This is a regression problem from 2.0.0p0. + + * test/ruby/test_iseq.rb: add a test of lines after ISeq#to_a. + Mon Mar 25 00:41:23 2013 Nobuyoshi Nakada * tool/mkconfig.rb: reconstruct comma separated list values. a diff --git a/iseq.c b/iseq.c index a296544320..15c1fe13ae 100644 --- a/iseq.c +++ b/iseq.c @@ -1841,7 +1841,7 @@ iseq_data_to_ary(rb_iseq_t *iseq) rb_ary_push(body, (VALUE)label); } - if (iseq->line_info_size < ti && iseq->line_info_table[ti].position == pos) { + if (ti < iseq->line_info_size && iseq->line_info_table[ti].position == pos) { line = iseq->line_info_table[ti].line_no; rb_ary_push(body, INT2FIX(line)); ti++; diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index 829b72ffdc..230cea9b91 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -9,6 +9,18 @@ class TestISeq < Test::Unit::TestCase assert_normal_exit('p RubyVM::InstructionSequence.compile("1", "mac", "", 0).to_a', bug5894) end + def test_to_a_lines + src = <<-EOS + p __LINE__ # 1 + p __LINE__ # 2 + # 3 + p __LINE__ # 4 + EOS + body = RubyVM::InstructionSequence.new(src).to_a[13] + lines = body.find_all{|e| e.kind_of? Fixnum} + assert_equal [1, 2, 4], lines + end + def test_unsupport_type ary = RubyVM::InstructionSequence.compile("p").to_a ary[9] = :foobar diff --git a/version.h b/version.h index b9c691fde3..01b402d618 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-03-25" -#define RUBY_PATCHLEVEL 87 +#define RUBY_PATCHLEVEL 88 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 3 -- cgit v1.2.3