[macruby-changes] [184] MacRuby/trunk/variable.c

source_changes at macosforge.org source_changes at macosforge.org
Thu May 1 16:31:29 PDT 2008


Revision: 184
          http://trac.macosforge.org/projects/ruby/changeset/184
Author:   lsansonetti at apple.com
Date:     2008-05-01 16:31:28 -0700 (Thu, 01 May 2008)

Log Message:
-----------
fixing ivar lookup for pure objc objects, fixing #34

Modified Paths:
--------------
    MacRuby/trunk/variable.c

Modified: MacRuby/trunk/variable.c
===================================================================
--- MacRuby/trunk/variable.c	2008-05-01 23:12:24 UTC (rev 183)
+++ MacRuby/trunk/variable.c	2008-05-01 23:31:28 UTC (rev 184)
@@ -287,7 +287,7 @@
 char *
 rb_class2name(VALUE klass)
 {
-    return RSTRING_CPTR(rb_class_name(klass));
+    return (char *)RSTRING_CPTR(rb_class_name(klass));
 }
 
 char *
@@ -1149,26 +1149,28 @@
 
 void rb_ivar_foreach(VALUE obj, int (*func)(ANYARGS), st_data_t arg)
 {
+#if WITH_OBJC
+    if (!rb_objc_is_non_native(obj))
+#endif
     switch (TYPE(obj)) {
       case T_OBJECT:
         obj_ivar_each(obj, func, arg);
-	break;
+	return;
       case T_CLASS:
       case T_MODULE:
 	if (RCLASS_IV_TBL(obj)) {
 	    st_foreach_safe(RCLASS_IV_TBL(obj), func, arg);
 	}
-	break;
-      default:
-	if (!generic_iv_tbl) break;
-	if (FL_TEST(obj, FL_EXIVAR) || rb_special_const_p(obj)) {
-	    st_data_t tbl;
+	return;
+    }
+    if (!generic_iv_tbl)
+	return; 
+    if (FL_TEST(obj, FL_EXIVAR) || rb_special_const_p(obj)) {
+	st_data_t tbl;
 
-	    if (st_lookup(generic_iv_tbl, obj, &tbl)) {
-		st_foreach_safe((st_table *)tbl, func, arg);
-	    }
+	if (st_lookup(generic_iv_tbl, obj, &tbl)) {
+	    st_foreach_safe((st_table *)tbl, func, arg);
 	}
-	break;
     }
 }
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080501/531b1065/attachment.html


More information about the macruby-changes mailing list