[MacRuby] #1197: __method__ and __callee__ return nil if called inside of a block
#1197: __method__ and __callee__ return nil if called inside of a block --------------------------------------+------------------------------------- Reporter: warpflyght@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: --------------------------------------+------------------------------------- Under Ruby 1.9.1, calling `__method__`/`__callee__` inside of a block still returns the current method name. Under MacRuby r5278, this does not happen. Here's a simple test program that reproduces the issue: {{{ #!ruby def foo b = proc { warn __method__ } bar(&b) end def bar(&block) block.call end foo }}} Running it produces this output: {{{ #!sh $ macruby /tmp/method.rb $ ruby1.9 /tmp/method.rb foo }}} To work around this, the value of `__method__` can be captured in a variable outside of the block and referenced inside. -- Ticket URL: <http://www.macruby.org/trac/ticket/1197> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby