Rubyspec Language#return failure, define_method with return in the method -------------------------------------------------------------------------
Key: JRUBY-6122 URL: https://jira.codehaus.org/browse/JRUBY-6122 Project: JRuby Issue Type: Bug Affects Versions: JRuby 1.7 Reporter: Martin Harriman Assignee: Thomas E Enebo Priority: Minor This works in MRI, fails in jruby 1.7: The return keyword within define_method stops at the method when the return is used directly. The relevant fixture code: {noformat} class DefineMethod lamb = proc { return :good } define_method :foo, lamb def outer val = :bad # This is tricky, but works. If lamb properly returns, then the # return value will go into val before we run the ensure. # # If lamb's return keeps unwinding incorrectly, val will still # have it's old value. # # We can therefore use val to figure out what happened. begin val = foo() ensure if val != :good return :bad end end return val end end {noformat} -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email