[前][次][番号順一覧][スレッド一覧]

ruby-changes:27858

From: nagachika <ko1@a...>
Date: Mon, 25 Mar 2013 00:47:34 +0900 (JST)
Subject: [ruby-changes:27858] nagachika:r39910 (ruby_2_0_0): merge revision(s) 39536: [Backport #7989]

nagachika	2013-03-25 00:47:22 +0900 (Mon, 25 Mar 2013)

  New Revision: 39910

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39910

  Log:
    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.

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/iseq.c
    branches/ruby_2_0_0/test/ruby/test_iseq.rb
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 39909)
+++ ruby_2_0_0/ChangeLog	(revision 39910)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Mon Mar 25 00:47:04 2013  Koichi Sasada  <ko1@a...>
+
+	* 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  <nobu@r...>
 
 	* tool/mkconfig.rb: reconstruct comma separated list values.  a
Index: ruby_2_0_0/iseq.c
===================================================================
--- ruby_2_0_0/iseq.c	(revision 39909)
+++ ruby_2_0_0/iseq.c	(revision 39910)
@@ -1841,7 +1841,7 @@ iseq_data_to_ary(rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/iseq.c#L1841
 	    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++;
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 39909)
+++ ruby_2_0_0/version.h	(revision 39910)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #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
Index: ruby_2_0_0/test/ruby/test_iseq.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_iseq.rb	(revision 39909)
+++ ruby_2_0_0/test/ruby/test_iseq.rb	(revision 39910)
@@ -9,6 +9,18 @@ class TestISeq < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_iseq.rb#L9
     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

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r39536


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]