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

ruby-changes:42521

From: naruse <ko1@a...>
Date: Fri, 15 Apr 2016 15:26:17 +0900 (JST)
Subject: [ruby-changes:42521] naruse:r54595 (ruby_2_3): merge revision(s) 53381: [Backport #11916]

naruse	2016-04-15 16:22:53 +0900 (Fri, 15 Apr 2016)

  New Revision: 54595

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54595

  Log:
    merge revision(s) 53381: [Backport #11916]
    
    * lib/forwardable.rb (def_instance_delegator) fix delegating to
      'args' and 'block', clashing with local variables in generated
      methods.  [ruby-core:72579] [Bug #11916]
    
    * lib/forwardable.rb (def_single_delegator): ditto.

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/lib/forwardable.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/lib/forwardable.rb
===================================================================
--- ruby_2_3/lib/forwardable.rb	(revision 54594)
+++ ruby_2_3/lib/forwardable.rb	(revision 54595)
@@ -178,6 +178,10 @@ module Forwardable https://github.com/ruby/ruby/blob/trunk/ruby_2_3/lib/forwardable.rb#L178
   #   q.push 23  #=> NoMethodError
   #
   def def_instance_delegator(accessor, method, ali = method)
+    if method_defined?(accessor) || private_method_defined?(accessor)
+      accessor = "#{accessor}()"
+    end
+
     line_no = __LINE__; str = %{
       def #{ali}(*args, &block)
         begin
@@ -270,7 +274,11 @@ module SingleForwardable https://github.com/ruby/ruby/blob/trunk/ruby_2_3/lib/forwardable.rb#L274
   # the method of the same name in _accessor_).  If _new_name_ is
   # provided, it is used as the name for the delegate method.
   def def_single_delegator(accessor, method, ali = method)
-    str = %{
+    if method_defined?(accessor) || private_method_defined?(accessor)
+      accessor = "#{accessor}()"
+    end
+
+    line_no = __LINE__; str = %{
       def #{ali}(*args, &block)
         begin
           #{accessor}.__send__(:#{method}, *args, &block)
@@ -281,7 +289,7 @@ module SingleForwardable https://github.com/ruby/ruby/blob/trunk/ruby_2_3/lib/forwardable.rb#L289
       end
     }
 
-    instance_eval(str, __FILE__, __LINE__)
+    instance_eval(str, __FILE__, line_no)
   end
 
   alias delegate single_delegate
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 54594)
+++ ruby_2_3/version.h	(revision 54595)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.0"
 #define RUBY_RELEASE_DATE "2016-04-15"
-#define RUBY_PATCHLEVEL 79
+#define RUBY_PATCHLEVEL 80
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 4
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 54594)
+++ ruby_2_3/ChangeLog	(revision 54595)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Fri Apr 15 14:52:06 2016  Elliot Winkler  <elliot.winkler@g...>
+
+	* lib/forwardable.rb (def_instance_delegator) fix delegating to
+	  'args' and 'block', clashing with local variables in generated
+	  methods.  [ruby-core:72579] [Bug #11916]
+
+	* lib/forwardable.rb (def_single_delegator): ditto.
+
 Fri Apr 15 14:27:48 2016  NARUSE, Yui  <naruse@r...>
 
 	* lib/irb/ext/save-history.rb: suppress warning: method redefined;

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r53381


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

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