[macruby-changes] [2795] MacRuby/trunk/vm.cpp

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 14 13:12:48 PDT 2009


Revision: 2795
          http://trac.macosforge.org/projects/ruby/changeset/2795
Author:   lsansonetti at apple.com
Date:     2009-10-14 13:12:47 -0700 (Wed, 14 Oct 2009)
Log Message:
-----------
added autoload check to the VM const get primitive

Modified Paths:
--------------
    MacRuby/trunk/vm.cpp

Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp	2009-10-14 05:20:16 UTC (rev 2794)
+++ MacRuby/trunk/vm.cpp	2009-10-14 20:12:47 UTC (rev 2795)
@@ -959,9 +959,13 @@
     // Search the given class.
     CFDictionaryRef iv_dict = rb_class_ivar_dict(klass);
     if (iv_dict != NULL) {
+retry:
 	VALUE value;
 	if (CFDictionaryGetValueIfPresent(iv_dict, (const void *)id,
 		    (const void **)&value)) {
+	    if (value == Qundef && RTEST(rb_autoload_load(klass, id))) {
+		goto retry;
+	    }
 	    return value;
 	}
     }
@@ -970,7 +974,8 @@
     if (mods != Qnil) {
 	int i, count = RARRAY_LEN(mods);
 	for (i = 0; i < count; i++) {
-	    VALUE val = rb_const_get_direct(RARRAY_AT(mods, i), id);
+	    VALUE mod = RARRAY_AT(mods, i);
+	    VALUE val = rb_const_get_direct(mod, id);
 	    if (val != Qundef) {
 		return val;
 	    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091014/954daf90/attachment.html>


More information about the macruby-changes mailing list