|
|
|
[
Permlink
| « Hide
]
Stuart Ellidge - 29/Apr/08 11:17 AM
I can confirm that the same issue exists with JRuby 1.1.1
Script that works in MRI, fails in JRuby 1.1.1, thus reproducing the issue
In CallSite.java:102 the call to method.isCallableFrom fails because the current frame has erroneously had its self object set to the string passed into the method (="current"). It would seem highly likely that the code below is the culprit, as it is evaluated prior to isCallableFrom failing:
CallBlock.java:82 public IRubyObject yield(ThreadContext context, IRubyObject value, IRubyObject self, return callback.call(context, new IRubyObject[] {value}, Block.NULL_BLOCK); Sorry, that's (from CallBlock.java:82 in trunk):
public IRubyObject yield(ThreadContext context, IRubyObject value, IRubyObject self, RubyModule klass, boolean aValue, Binding binding, Block.Type type) { if (klass == null) { self = binding.getSelf(); // FIXME: We never set this back! binding.getFrame().setSelf(self); } return callback.call(context, new IRubyObject[] {value}, Block.NULL_BLOCK); } Attaching a patch which seems to fix the issue, while keeping the tests running.
Testcase for inclusion in the unit test suite.
I committed a slightly modified version of this patch that uses try/finally to guarantee the frame self gets set back. Thanks Steen!
Thanks Charlie! You could even take out the line "// FIXME: We never set this back!" since now we do
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||