[MacRuby/MacRuby] 729bf7: fix a bug in defined?(super) which returns the inc...
Branch: refs/heads/master Home: https://github.com/MacRuby/MacRuby Commit: 729bf78935279199e20ba377b7a2a8e91a89980e https://github.com/MacRuby/MacRuby/commit/729bf78935279199e20ba377b7a2a8e91a... Author: Watson <watson1978@gmail.com> Date: 2013-06-16 (Sun, 16 Jun 2013) Changed paths: M vm.cpp Log Message: ----------- fix a bug in defined?(super) which returns the incorrect value if use in included module Test Code: ---- module Stuff def foo puts "In Stuff#foo" if defined?(super) puts "Calling super" super else puts "No super" end end end module OtherStuff def foo puts "In OtherStuff#foo" p defined?(super) end end class NoSuper include Stuff end NoSuper.new.foo class WithSuper include OtherStuff include Stuff end WithSuper.new.foo Result ---- $ macruby t.rb In Stuff#foo Calling super /Volumes/Mac/Users/watson/tmp/t.rb:6:in `foo': super: no superclass method `foo' for #<NoSuper:0x4001a33a0> (NoMethodError) from /Volumes/Mac/Users/watson/tmp/t.rb:23:in `<main>' Expected ---- $ ruby t.rb In Stuff#foo No super In Stuff#foo Calling super In OtherStuff#foo nil
participants (1)
-
GitHub