aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-08 03:36:58 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-08 03:36:58 +0000
commitee68f78c2462908882e3394f8a91631ec4a45beb (patch)
treed2049485ecaa88661958e9e0ff69a80e872da759
parentd928280cb6644d2d899aadf7bfc8cf4e1b5e2997 (diff)
downloadruby-ee68f78c2462908882e3394f8a91631ec4a45beb.tar.gz
* vm_insnhelper.c (vm_search_normal_superclass): super in a
refinement always uses the refined class as its superclass. * test/ruby/test_refinement.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--test/ruby/test_refinement.rb4
-rw-r--r--vm_insnhelper.c10
3 files changed, 19 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 198d9a131a..44fecd9490 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sat Dec 8 12:34:01 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_search_normal_superclass): super in a
+ refinement always uses the refined class as its superclass.
+
+ * test/ruby/test_refinement.rb: related test.
+
Sat Dec 8 11:59:59 2012 Shugo Maeda <shugo@ruby-lang.org>
* eval.c (rb_mod_refine): raise an ArgumentError if a given
@@ -7,6 +14,8 @@ Sat Dec 8 11:59:59 2012 Shugo Maeda <shugo@ruby-lang.org>
cache to improve performance. It's safe now because blocks cannot
be yielded with different refinements in the new specification.
+ * test/ruby/test_refinement.rb: related test.
+
Sat Dec 8 11:17:53 2012 Shugo Maeda <shugo@ruby-lang.org>
* eval.c (rb_mod_refine), vm_eval.c (rb_yield_refine_block):
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index 05ac1030c5..0d934d737e 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -115,10 +115,10 @@ class TestRefinement < Test::Unit::TestCase
assert_equal("Foo#y", foo.y)
end
- def test_super_chain
+ def test_super_not_chained
foo = Foo.new
assert_equal("Foo#y", foo.y)
- assert_equal("FooExt2#y FooExt#y Foo#y", FooExtClient2.invoke_y_on(foo))
+ assert_equal("FooExt2#y Foo#y", FooExtClient2.invoke_y_on(foo))
assert_equal("Foo#y", foo.y)
end
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 4d0d6b6185..5743654953 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1866,8 +1866,14 @@ vm_call_super_method(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_info_
static inline VALUE
vm_search_normal_superclass(VALUE klass)
{
- klass = RCLASS_ORIGIN(klass);
- return RCLASS_SUPER(klass);
+ if (BUILTIN_TYPE(klass) == T_ICLASS &&
+ FL_TEST(RBASIC(klass)->klass, RMODULE_IS_REFINEMENT)) {
+ return rb_refinement_module_get_refined_class(RBASIC(klass)->klass);
+ }
+ else {
+ klass = RCLASS_ORIGIN(klass);
+ return RCLASS_SUPER(klass);
+ }
}
static void