[macruby-changes] [MacRuby/MacRuby] e6bcc6: [fix #203] fix a bug in super which fails to look ...
GitHub
noreply at github.com
Wed Apr 3 20:08:23 PDT 2013
Branch: refs/heads/master
Home: https://github.com/MacRuby/MacRuby
Commit: e6bcc6a256a27ee42706f79524748f975f47d2a0
https://github.com/MacRuby/MacRuby/commit/e6bcc6a256a27ee42706f79524748f975f47d2a0
Author: Watson <watson1978 at gmail.com>
Date: 2013-04-03 (Wed, 03 Apr 2013)
Changed paths:
M dispatcher.cpp
Log Message:
-----------
[fix #203] fix a bug in super which fails to look up method in method which called by super
The 'super' saves the calling status (caller class, selector, etc).
At twice 'super' calling, look up wrong class.
The following sequence had executed.
- Base (Super class)
- Foo (Inherited Base)
1. Foo#bar -- super --> look up super class of Foo (Base)
2. Foo#bar -- super --> look up super class of Base
----
class Base
def bar(args)
$result << args.first
if args = args[1..-1]
obj = Foo.new
obj.bar(args)
end
end
end
class Foo < Base
def bar(args)
$result << "a"
super
end
end
$result = []
obj = Foo.new
obj.bar(%w{1 2 3})
p $result
More information about the macruby-changes
mailing list