[macruby-changes] [706] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Mon Nov 3 00:19:05 PST 2008
Revision: 706
http://trac.macosforge.org/projects/ruby/changeset/706
Author: lsansonetti at apple.com
Date: 2008-11-03 00:19:03 -0800 (Mon, 03 Nov 2008)
Log Message:
-----------
fixed a bug where conversion helper methods would not use the BS type
Modified Paths:
--------------
MacRuby/trunk/test/ruby/test_objc.rb
MacRuby/trunk/vm_insnhelper.c
Modified: MacRuby/trunk/test/ruby/test_objc.rb
===================================================================
--- MacRuby/trunk/test/ruby/test_objc.rb 2008-11-03 06:56:04 UTC (rev 705)
+++ MacRuby/trunk/test/ruby/test_objc.rb 2008-11-03 08:19:03 UTC (rev 706)
@@ -14,6 +14,9 @@
@end
@interface Dummy : NSObject
+{
+ int x;
+}
@end
@implementation Dummy
@@ -50,6 +53,21 @@
[NSException raise:@"testCallGetLongMethod" format:@"expected %@, got %@", NSStringFromRect(val), NSStringFromRect(r)];
}
+- (int)X
+{
+ return x;
+}
+
+- (void)setX:(int)aX
+{
+ x = aX;
+}
+
+- (int)isX
+{
+ return x == 1;
+}
+
@end
void Init_dummy(void) {}
@@ -456,4 +474,17 @@
assert_equal(NSMakeRect(0, 0, 10, 100), p1[0])
assert_equal(NSMakeRect(10, 0, 90, 100), p2[0])
end
+
+ def test_conversion_helpers
+ o = Dummy.new
+ o.setX(1)
+ assert_equal(1, o.X)
+ assert_equal(1, o.isX)
+ o.X = 2
+ assert_equal(2, o.X)
+ assert_equal(0, o.X?)
+ o = NSBundle.mainBundle
+ assert_equal(true, o.isLoaded)
+ assert_equal(true, o.loaded?)
+ end
end
Modified: MacRuby/trunk/vm_insnhelper.c
===================================================================
--- MacRuby/trunk/vm_insnhelper.c 2008-11-03 06:56:04 UTC (rev 705)
+++ MacRuby/trunk/vm_insnhelper.c 2008-11-03 08:19:03 UTC (rev 706)
@@ -56,7 +56,7 @@
cfp->bp = sp + 1;
cfp->iseq = (rb_iseq_t *) iseq;
cfp->flag = type;
- GC_WB(&cfp->self, self);
+ cfp->self = self;
cfp->lfp = lfp;
cfp->dfp = sp;
cfp->proc = 0;
@@ -875,9 +875,9 @@
goto rcall_dispatch;
}
}
- if (len >= 3) {
+ if (len >= 2) {
SEL sel = 0;
- if (isalpha(p[len - 3]) && p[len - 2] == '=' && p[len - 1] == ':') {
+ if (len >= 3 && isalpha(p[len - 3]) && p[len - 2] == '=' && p[len - 1] == ':') {
/* foo=: -> setFoo: shortcut */
snprintf(buf, sizeof buf, "set%s", p);
buf[3] = toupper(buf[3]);
@@ -905,11 +905,12 @@
mcache->as.rcall.sel = sel;
mcache->as.ocall.klass = klass;
mcache->as.ocall.imp = imp;
- mcache->as.ocall.sig.argc = method_getNumberOfArguments(method);
- mcache->as.ocall.sig.types = method_getTypeEncoding(method);
mcache->as.ocall.bs_method =
- rb_bs_find_method((Class)klass,
- mcache->as.rcall.sel);
+ rb_bs_find_method((Class)klass, sel);
+ assert(rb_objc_fill_sig(recv, (Class)klass,
+ mcache->as.rcall.sel,
+ &mcache->as.ocall.sig,
+ mcache->as.ocall.bs_method));
goto ocall_dispatch;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20081103/a9b7e74e/attachment.html>
More information about the macruby-changes
mailing list