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

ruby-changes:30984

From: nagachika <ko1@a...>
Date: Fri, 27 Sep 2013 01:22:31 +0900 (JST)
Subject: [ruby-changes:30984] nagachika:r43063 (ruby_2_0_0): merge revision(s) 42980, 42981: [Backport #8927]

nagachika	2013-09-27 01:22:24 +0900 (Fri, 27 Sep 2013)

  New Revision: 43063

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

  Log:
    merge revision(s) 42980,42981: [Backport #8927]
    
    * parse.y (lambda): adjust position to the beginning of the block.

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/parse.y
    branches/ruby_2_0_0/test/ruby/test_lambda.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 43062)
+++ ruby_2_0_0/ChangeLog	(revision 43063)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Fri Sep 27 01:11:21 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (lambda): adjust position to the beginning of the block.
+
 Fri Sep 27 01:02:59 2013  NARUSE, Yui  <naruse@r...>
 
 	* lib/uri/generic.rb (URI::Generic.find_proxy): return nil if
Index: ruby_2_0_0/parse.y
===================================================================
--- ruby_2_0_0/parse.y	(revision 43062)
+++ ruby_2_0_0/parse.y	(revision 43063)
@@ -3462,13 +3462,17 @@ lambda		:   { https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/parse.y#L3462
 			lpar_beg = ++paren_nest;
 		    }
 		  f_larglist
+		    {
+			$<num>$ = ruby_sourceline;
+		    }
 		  lambda_body
 		    {
 			lpar_beg = $<num>2;
 		    /*%%%*/
-			$$ = NEW_LAMBDA($3, $4);
+			$$ = NEW_LAMBDA($3, $5);
+			nd_set_line($$, $<num>4);
 		    /*%
-			$$ = dispatch2(lambda, $3, $4);
+			$$ = dispatch2(lambda, $3, $5);
 		    %*/
 			dyna_pop($<vars>1);
 		    }
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 43062)
+++ ruby_2_0_0/version.h	(revision 43063)
@@ -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-09-27"
-#define RUBY_PATCHLEVEL 319
+#define RUBY_PATCHLEVEL 320
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 9
Index: ruby_2_0_0/test/ruby/test_lambda.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_lambda.rb	(revision 43062)
+++ ruby_2_0_0/test/ruby/test_lambda.rb	(revision 43063)
@@ -89,4 +89,28 @@ class TestLambdaParameters < Test::Unit: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_lambda.rb#L89
     assert_send([e.backtrace.first, :start_with?, "#{__FILE__}:#{line}:"], bug6151)
     assert_equal(0, called)
   end
+
+  def test_do_lambda_source_location
+    exp_lineno = __LINE__ + 3
+    lmd = ->(x,
+             y,
+             z) do
+      #
+    end
+    file, lineno = lmd.source_location
+    assert_match(/^#{ Regexp.quote(__FILE__) }$/, file)
+    assert_equal(exp_lineno, lineno, "must be at the beginning of the block")
+  end
+
+  def test_brace_lambda_source_location
+    exp_lineno = __LINE__ + 3
+    lmd = ->(x,
+             y,
+             z) {
+      #
+    }
+    file, lineno = lmd.source_location
+    assert_match(/^#{ Regexp.quote(__FILE__) }$/, file)
+    assert_equal(exp_lineno, lineno, "must be at the beginning of the block")
+  end
 end

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r42980-42981


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

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