Revision
3370
Author
lsansonetti@apple.com
Date
2010-01-29 17:25:56 -0800 (Fri, 29 Jan 2010)

Log Message

fixed an autoload bug from a mixed module

Modified Paths

Diff

Modified: MacRuby/trunk/variable.c (3369 => 3370)


--- MacRuby/trunk/variable.c	2010-01-29 23:40:14 UTC (rev 3369)
+++ MacRuby/trunk/variable.c	2010-01-30 01:25:56 UTC (rev 3370)
@@ -56,6 +56,8 @@
     0, retain_cb, release_cb, NULL, NULL
 };
 
+static SEL selRequire = 0;
+
 void
 Init_var_tables(void)
 {
@@ -66,6 +68,7 @@
     autoload = rb_intern("__autoload__");
     classpath = rb_intern("__classpath__");
     tmp_classpath = rb_intern("__tmp_classpath__");
+    selRequire = sel_registerName("require:");
 }
 
 struct fc_result {
@@ -1483,6 +1486,11 @@
     if (!load || !(file = load->nd_lit)) {
 	return Qfalse;
     }
+    if (false) {
+	// XXX Apparently RubySpec does not want us to do that...
+	return rb_vm_call(*(VALUE *)rb_mKernel, selRequire, 1, &file,
+		false);
+    }
     return rb_require_safe(file, load->nd_nth);
 }
 
@@ -1569,7 +1577,7 @@
 		if (!RTEST(rb_autoload_load(tmp, id))) {
 		    break;
 		}
-		continue;
+		goto retry;
 	    }
 	    if (exclude && tmp == rb_cObject && klass != rb_cObject) {
 		rb_warn("toplevel constant %s referenced by %s::%s",
@@ -1593,7 +1601,7 @@
 			if (!RTEST(rb_autoload_load(mod, id))) {
 			    break;
 			}
-			continue;
+			goto retry;
 		    }
 		    return rb_vm_resolve_const_value(value, klass, id);
 		}