Revision
4536
Author
lsansonetti@apple.com
Date
2010-09-23 14:33:11 -0700 (Thu, 23 Sep 2010)

Log Message

#require: forget about the current binding during parsing

Modified Paths

Diff

Modified: MacRuby/trunk/load.c (4535 => 4536)


--- MacRuby/trunk/load.c	2010-09-23 00:44:01 UTC (rev 4535)
+++ MacRuby/trunk/load.c	2010-09-23 21:33:11 UTC (rev 4536)
@@ -87,7 +87,15 @@
     // Load it.
     const char *fname_str = RSTRING_PTR(fname);
 //printf("load %s\n", fname_str);
+
+    rb_vm_binding_t *b = rb_vm_current_binding();
+    if (b != NULL) {
+	rb_vm_pop_binding();
+    }
     NODE *node = (NODE *)rb_load_file(fname_str);
+    if (b != NULL) {
+	rb_vm_add_binding(b);
+    }
     if (node == NULL) {
 	rb_raise(rb_eSyntaxError, "compile error");
     }

Modified: MacRuby/trunk/vm.cpp (4535 => 4536)


--- MacRuby/trunk/vm.cpp	2010-09-23 00:44:01 UTC (rev 4535)
+++ MacRuby/trunk/vm.cpp	2010-09-23 21:33:11 UTC (rev 4536)
@@ -3734,7 +3734,7 @@
 	if (create) {
 	    GC_WB(l, xmalloc(sizeof(rb_vm_local_t)));
 	    (*l)->name = name;
-	    GC_WB(&(*l)->value, xmalloc(sizeof(VALUE)));
+	    GC_WB(&(*l)->value, xmalloc(sizeof(VALUE *)));
 	    (*l)->next = NULL;
 	    return (*l)->value;
 	}