ruby-changes:24586
From: nobu <ko1@a...>
Date: Mon, 6 Aug 2012 11:34:49 +0900 (JST)
Subject: [ruby-changes:24586] nobu:r36637 (trunk): insns.def: use klass in cfp
nobu 2012-08-06 11:34:36 +0900 (Mon, 06 Aug 2012) New Revision: 36637 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36637 Log: insns.def: use klass in cfp * insns.def (defined): now should use klass in the current control frame to search superclass, not me->klass. reported by naruse. Modified files: trunk/ChangeLog trunk/insns.def trunk/test/ruby/test_defined.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 36636) +++ ChangeLog (revision 36637) @@ -1,3 +1,8 @@ +Mon Aug 6 11:34:33 2012 Nobuyoshi Nakada <nobu@r...> + + * insns.def (defined): now should use klass in the current control + frame to search superclass, not me->klass. reported by naruse. + Mon Aug 6 11:19:19 2012 NAKAMURA Usaku <usa@r...> * test/etc/test_etc.rb (TestEtc#test_getpwuid): `s' is never set to nil. Index: insns.def =================================================================== --- insns.def (revision 36636) +++ insns.def (revision 36637) @@ -828,7 +828,7 @@ case DEFINED_ZSUPER:{ const rb_method_entry_t *me = GET_CFP()->me; if (me) { - VALUE klass = vm_search_normal_superclass(me->klass); + VALUE klass = vm_search_normal_superclass(GET_CFP()->klass); ID id = me->def ? me->def->original_id : me->called_id; if (rb_method_boundp(klass, id, 0)) { expr_type = "super"; Index: test/ruby/test_defined.rb =================================================================== --- test/ruby/test_defined.rb (revision 36636) +++ test/ruby/test_defined.rb (revision 36637) @@ -152,4 +152,22 @@ assert_equal("super", aa.f, bug6644) assert_nil(a.f, bug6644) end + + def test_super_in_included_method + c0 = Class.new do + def m + end + end + m1 = Module.new do + def m + defined?(super) + end + end + c = Class.new(c0) do include m1 + def m + super + end + end + assert_equal("super", c.new.m) + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/