[macruby-changes] [3920] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Mon Apr 12 18:08:16 PDT 2010


Revision: 3920
          http://trac.macosforge.org/projects/ruby/changeset/3920
Author:   lsansonetti at apple.com
Date:     2010-04-12 18:08:15 -0700 (Mon, 12 Apr 2010)
Log Message:
-----------
better ignored sel detection

Modified Paths:
--------------
    MacRuby/trunk/id.c
    MacRuby/trunk/id.h
    MacRuby/trunk/objc.h
    MacRuby/trunk/objc.m
    MacRuby/trunk/vm.cpp

Modified: MacRuby/trunk/id.c
===================================================================
--- MacRuby/trunk/id.c	2010-04-12 21:34:42 UTC (rev 3919)
+++ MacRuby/trunk/id.c	2010-04-13 01:08:15 UTC (rev 3920)
@@ -76,8 +76,6 @@
     selMethodMissing = sel_registerName("method_missing:");
     selCopy = sel_registerName("copy");
     selMutableCopy = sel_registerName("mutableCopy");
-    sel_ignored = sel_registerName("retain");
-    assert(sel_ignored == sel_registerName("release"));
     sel_zone = sel_registerName("zone");
     selToS = sel_registerName("to_s");
     selToAry = sel_registerName("to_ary");

Modified: MacRuby/trunk/id.h
===================================================================
--- MacRuby/trunk/id.h	2010-04-12 21:34:42 UTC (rev 3919)
+++ MacRuby/trunk/id.h	2010-04-13 01:08:15 UTC (rev 3920)
@@ -88,7 +88,6 @@
 extern SEL selMutableCopy;
 extern SEL selToS;
 extern SEL selToAry;
-extern SEL sel_ignored;
 extern SEL sel_zone;
 extern SEL selSend;
 extern SEL sel__send__;

Modified: MacRuby/trunk/objc.h
===================================================================
--- MacRuby/trunk/objc.h	2010-04-12 21:34:42 UTC (rev 3919)
+++ MacRuby/trunk/objc.h	2010-04-13 01:08:15 UTC (rev 3920)
@@ -233,6 +233,8 @@
 
 void rb_objc_exception_raise(const char *name, const char *message);
 
+bool rb_objc_ignore_sel(SEL sel);
+
 #if defined(__cplusplus)
 }
 #endif

Modified: MacRuby/trunk/objc.m
===================================================================
--- MacRuby/trunk/objc.m	2010-04-12 21:34:42 UTC (rev 3919)
+++ MacRuby/trunk/objc.m	2010-04-13 01:08:15 UTC (rev 3920)
@@ -635,6 +635,16 @@
 	reason:[NSString stringWithUTF8String:message] userInfo:nil] raise];
 }
 
+bool
+rb_objc_ignore_sel(SEL sel)
+{
+  return sel == @selector(retain)
+      || sel == @selector(release)
+      || sel == @selector(autorelease)
+      || sel == @selector(retainCount)
+      || sel == @selector(dealloc);
+}
+
 size_t
 rb_objc_type_size(const char *type)
 {

Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp	2010-04-12 21:34:42 UTC (rev 3919)
+++ MacRuby/trunk/vm.cpp	2010-04-13 01:08:15 UTC (rev 3920)
@@ -2115,7 +2115,7 @@
 	flags |= VM_METHOD_PROTECTED;
     }
 
-    if (sel == sel_ignored) {
+    if (rb_objc_ignore_sel(sel)) {
 	// TODO
 	return;
     }
@@ -2236,7 +2236,7 @@
 static void
 push_method(VALUE ary, SEL sel, int flags, int (*filter) (VALUE, ID, VALUE))
 {
-    if (sel == sel_ignored) {
+    if (rb_objc_ignore_sel(sel)) {
 	return; 
     }
 
@@ -2560,7 +2560,7 @@
 {
     assert(klass != NULL);
 
-    if (sel == sel_ignored) {
+    if (rb_objc_ignore_sel(sel)) {
 	// TODO
 	return NULL;
     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100412/43a3833a/attachment-0001.html>


More information about the macruby-changes mailing list