mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7c5336b8f9
commit
cc48423ead
3 changed files with 24 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Aug 6 11:34:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* test/etc/test_etc.rb (TestEtc#test_getpwuid): `s' is never set to nil.
|
||||
|
|
|
@ -828,7 +828,7 @@ defined
|
|||
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";
|
||||
|
|
|
@ -152,4 +152,22 @@ class TestDefined < Test::Unit::TestCase
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue