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

ruby-changes:23396

From: mame <ko1@a...>
Date: Tue, 24 Apr 2012 00:25:06 +0900 (JST)
Subject: [ruby-changes:23396] mame:r35447 (trunk): * parse.y (primary): remove wrong "fixpos" that caused incorrect

mame	2012-04-24 00:23:41 +0900 (Tue, 24 Apr 2012)

  New Revision: 35447

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

  Log:
    * parse.y (primary): remove wrong "fixpos" that caused incorrect
      source_location of blocks.  [ruby-core:42232] [Bug #5930]
    
    * test/ruby/test_proc.rb: add a test for above.

  Modified files:
    trunk/ChangeLog
    trunk/parse.y
    trunk/test/ruby/test_proc.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35446)
+++ ChangeLog	(revision 35447)
@@ -1,3 +1,10 @@
+Tue Apr 24 00:14:42 2012  Yusuke Endoh  <mame@t...>
+
+	* parse.y (primary): remove wrong "fixpos" that caused incorrect
+	  source_location of blocks.  [ruby-core:42232] [Bug #5930]
+
+	* test/ruby/test_proc.rb: add a test for above.
+
 Mon Apr 23 22:56:08 2012  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/iconv: deprecated.  [Feature #6322]
Index: parse.y
===================================================================
--- parse.y	(revision 35446)
+++ parse.y	(revision 35447)
@@ -2813,7 +2813,6 @@
 		    /*%%%*/
 			$2->nd_iter = NEW_FCALL($1, 0);
 			$$ = $2;
-			fixpos($2->nd_iter, $2);
 		    /*%
 			$$ = method_arg(dispatch1(fcall, $1), arg_new());
 			$$ = method_add_block($$, $2);
@@ -2826,7 +2825,6 @@
 			block_dup_check($1->nd_args, $2);
 			$2->nd_iter = $1;
 			$$ = $2;
-			fixpos($$, $1);
 		    /*%
 			$$ = method_add_block($1, $2);
 		    %*/
Index: test/ruby/test_proc.rb
===================================================================
--- test/ruby/test_proc.rb	(revision 35446)
+++ test/ruby/test_proc.rb	(revision 35447)
@@ -1059,6 +1059,20 @@
     assert_equal(@@line_of_attr_accessor_source_location_test, lineno)
   end
 
+  def block_source_location_test(*args, &block)
+    block.source_location
+  end
+
+  def test_block_source_location
+    exp_lineno = __LINE__ + 3
+    file, lineno = block_source_location_test(1,
+                                              2,
+                                              3) do
+                                              end
+    assert_match(/^#{ Regexp.quote(__FILE__) }$/, file)
+    assert_equal(exp_lineno, lineno)
+  end
+
   def test_splat_without_respond_to
     def (obj = Object.new).respond_to?(m,*); false end
     [obj].each do |a, b|

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

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