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

ruby-changes:40981

From: shugo <ko1@a...>
Date: Sun, 13 Dec 2015 00:09:11 +0900 (JST)
Subject: [ruby-changes:40981] shugo:r53060 (trunk): * vm_insnhelper.c (vm_call_method_missing): method_missing should

shugo	2015-12-13 00:08:52 +0900 (Sun, 13 Dec 2015)

  New Revision: 53060

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

  Log:
    * vm_insnhelper.c (vm_call_method_missing): method_missing should
      not be refined.
      [ruby-core:72080] [Bug #11809]

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_refinement.rb
    trunk/vm_insnhelper.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53059)
+++ ChangeLog	(revision 53060)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Dec 13 00:05:42 2015  Shugo Maeda  <shugo@r...>
+
+	* vm_insnhelper.c (vm_call_method_missing): method_missing should
+	  not be refined.
+	  [ruby-core:72080] [Bug #11809]
+
 Sat Dec 12 23:00:17 2015  NARUSE, Yui  <naruse@r...>
 
 	* ext/nkf/nkf-utf8/nkf.c: Merge nkf 2.1.4.
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 53059)
+++ vm_insnhelper.c	(revision 53060)
@@ -1953,7 +1953,9 @@ vm_call_method_missing(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1953
     ci = &ci_entry;
 
     cc_entry = *orig_cc;
-    cc_entry.me = rb_callable_method_entry(CLASS_OF(calling->recv), idMethodMissing);
+    cc_entry.me =
+       	rb_callable_method_entry_without_refinements(CLASS_OF(calling->recv),
+						     idMethodMissing);
     cc = &cc_entry;
 
     calling->argc = argc;
Index: test/ruby/test_refinement.rb
===================================================================
--- test/ruby/test_refinement.rb	(revision 53059)
+++ test/ruby/test_refinement.rb	(revision 53060)
@@ -1594,6 +1594,31 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_refinement.rb#L1594
     assert_equal([:R2_baz, [:R1_foo, :orig_foo]], MixedUsing2.f2)
   end
 
+  module MethodMissing
+    class Foo
+    end
+
+    module Bar
+      refine Foo  do
+        def method_missing(mid, *args)
+          "method_missing refined"
+        end
+      end
+    end
+
+    using Bar
+
+    def self.call_undefined_method
+      Foo.new.foo
+    end
+  end
+
+  def test_method_missing
+    assert_raise(NoMethodError) do
+      MethodMissing.call_undefined_method
+    end
+  end
+
   private
 
   def eval_using(mod, s)

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

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