[macruby-changes] [3949] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue Apr 20 20:51:37 PDT 2010
Revision: 3949
http://trac.macosforge.org/projects/ruby/changeset/3949
Author: martinlagardette at apple.com
Date: 2010-04-20 20:51:32 -0700 (Tue, 20 Apr 2010)
Log Message:
-----------
Forward the block when forwarding a ruby method call from NSString to RubyString
Modified Paths:
--------------
MacRuby/trunk/NSString.m
MacRuby/trunk/spec/macruby/core/string_spec.rb
Modified: MacRuby/trunk/NSString.m
===================================================================
--- MacRuby/trunk/NSString.m 2010-04-21 02:29:46 UTC (rev 3948)
+++ MacRuby/trunk/NSString.m 2010-04-21 03:51:32 UTC (rev 3949)
@@ -173,14 +173,17 @@
static VALUE
nsstr_forward(id rcv, SEL sel, int argc, VALUE *argv)
{
- return rb_vm_call(nsstr_to_rstr(rcv), sel, argc, argv, false);
+ return rb_vm_call_with_cache2(rb_vm_get_call_cache(sel),
+ rb_vm_current_block(), nsstr_to_rstr(rcv), rb_cRubyString, sel, argc,
+ argv);
}
static VALUE
nsstr_forward_bang(id rcv, SEL sel, int argc, VALUE *argv)
{
VALUE rcv_rstr = nsstr_to_rstr(rcv);
- VALUE ret = rb_vm_call(rcv_rstr, sel, argc, argv, false);
+ VALUE ret = rb_vm_call_with_cache2(rb_vm_get_call_cache(sel),
+ rb_vm_current_block(), rcv_rstr, rb_cRubyString, sel, argc, argv);
[rcv setString:(id)rcv_rstr];
return ret;
}
Modified: MacRuby/trunk/spec/macruby/core/string_spec.rb
===================================================================
--- MacRuby/trunk/spec/macruby/core/string_spec.rb 2010-04-21 02:29:46 UTC (rev 3948)
+++ MacRuby/trunk/spec/macruby/core/string_spec.rb 2010-04-21 03:51:32 UTC (rev 3949)
@@ -81,4 +81,8 @@
# TODO
#lambda { a << 'foo' }.should raise_error(RuntimeError)
end
+
+ it "forwards the block when calling a ruby method" do
+ NSString.stringWithString("ybuRcaM").sub(/.+/) { |s| s.reverse }.should == "MacRuby"
+ end
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100420/3558d536/attachment.html>
More information about the macruby-changes
mailing list