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

ruby-changes:32972

From: nagachika <ko1@a...>
Date: Thu, 20 Feb 2014 01:58:59 +0900 (JST)
Subject: [ruby-changes:32972] nagachika:r45051 (ruby_2_0_0): merge revision(s) r44527: [Backport #9377]

nagachika	2014-02-20 01:58:53 +0900 (Thu, 20 Feb 2014)

  New Revision: 45051

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

  Log:
    merge revision(s) r44527: [Backport #9377]
    
    * vm_insnhelper.c (vm_search_super_method): when super called in a
      bound UnboundMethod generated from a module, no superclass is
      found since the current defined class is the module, then call
      method_missing in that case.  [ruby-core:59619] [Bug #9377]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/test/ruby/test_super.rb
    branches/ruby_2_0_0/version.h
    branches/ruby_2_0_0/vm_insnhelper.c
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 45050)
+++ ruby_2_0_0/ChangeLog	(revision 45051)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Thu Feb 20 01:54:08 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm_insnhelper.c (vm_search_super_method): when super called in a
+	  bound UnboundMethod generated from a module, no superclass is
+	  found since the current defined class is the module, then call
+	  method_missing in that case.  [ruby-core:59619] [Bug #9377]
+
 Thu Feb 20 01:33:06 2014  Eric Hodel  <drbrain@s...>
 
 	* lib/optparse.rb:  The Integer acceptable now allows binary and
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 45050)
+++ ruby_2_0_0/version.h	(revision 45051)
@@ -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 "2014-02-20"
-#define RUBY_PATCHLEVEL 439
+#define RUBY_PATCHLEVEL 440
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 2
Index: ruby_2_0_0/vm_insnhelper.c
===================================================================
--- ruby_2_0_0/vm_insnhelper.c	(revision 45050)
+++ ruby_2_0_0/vm_insnhelper.c	(revision 45051)
@@ -2031,6 +2031,12 @@ vm_search_super_method(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_insnhelper.c#L2031
 		 " by define_method() is not supported."
 		 " Specify all arguments explicitly.");
     }
+    if (!ci->klass) {
+	/* bound instance method of module */
+	ci->aux.missing_reason = NOEX_SUPER;
+	CI_SET_FASTPATH(ci, vm_call_method_missing, 1);
+	return;
+    }
 
     /* TODO: use inline cache */
     ci->me = rb_method_entry(ci->klass, ci->mid, &ci->defined_class);
Index: ruby_2_0_0/test/ruby/test_super.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_super.rb	(revision 45050)
+++ ruby_2_0_0/test/ruby/test_super.rb	(revision 45051)
@@ -441,4 +441,17 @@ class TestSuper < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_super.rb#L441
       assert_equal(:ok, o.method(:foo).call, bug9315)
     end
   end
+
+  def test_missing_super_in_module_unbound_method
+    bug9377 = '[ruby-core:59619] [Bug #9377]'
+
+    a = Module.new do
+      def foo; super end
+    end
+
+    m = a.instance_method(:foo).bind(Object.new.extend(a))
+    assert_raise(NoMethodError, bug9377) do
+      m.call
+    end
+  end
 end

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


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

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