[macruby-changes] [218] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Sun May 25 18:19:21 PDT 2008
Revision: 218
http://trac.macosforge.org/projects/ruby/changeset/218
Author: lsansonetti at apple.com
Date: 2008-05-25 18:19:20 -0700 (Sun, 25 May 2008)
Log Message:
-----------
fix for #61
Modified Paths:
--------------
MacRuby/trunk/bootstraptest/test_objectspace.rb
MacRuby/trunk/gc.c
Modified: MacRuby/trunk/bootstraptest/test_objectspace.rb
===================================================================
--- MacRuby/trunk/bootstraptest/test_objectspace.rb 2008-05-25 08:25:09 UTC (rev 217)
+++ MacRuby/trunk/bootstraptest/test_objectspace.rb 2008-05-26 01:19:20 UTC (rev 218)
@@ -34,3 +34,11 @@
end
}
}, '[ruby-dev:31985]'
+
+assert_equal "[Class]", %q{
+ ObjectSpace.each_object(Class).map { |x| x.class }.uniq
+}, 'macruby #61'
+
+assert_equal "[Class, Module]", %q{
+ ObjectSpace.each_object(Module).map { |x| x.class }.uniq
+}, 'macruby #61'
Modified: MacRuby/trunk/gc.c
===================================================================
--- MacRuby/trunk/gc.c 2008-05-25 08:25:09 UTC (rev 217)
+++ MacRuby/trunk/gc.c 2008-05-26 01:19:20 UTC (rev 218)
@@ -2247,12 +2247,22 @@
if (type != AUTO_OBJECT_SCANNED && type != AUTO_OBJECT_UNSCANNED)
continue;
if (ctx->class_of != 0) {
- if (ctx->class_of == rb_cClass) {
- /* Class is a special case. */
+ if (ctx->class_of == rb_cClass || ctx->class_of == rb_cModule) {
+ /* Class/Module are a special case. */
if (rb_objc_is_non_native(r->address)
- || TYPE(r->address) != T_CLASS
|| FL_TEST(r->address, FL_SINGLETON))
continue;
+ if (ctx->class_of == rb_cClass) {
+ /* Only match classes. */
+ if (BUILTIN_TYPE(r->address) != T_CLASS)
+ continue;
+ }
+ else {
+ /* Match classes & modules. */
+ if (BUILTIN_TYPE(r->address) != T_CLASS
+ && BUILTIN_TYPE(r->address) != T_MODULE)
+ continue;
+ }
}
else {
unsigned ok = 0;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080525/213ba32a/attachment-0001.htm
More information about the macruby-changes
mailing list