[macruby-changes] [1041] MacRuby/branches/experimental

source_changes at macosforge.org source_changes at macosforge.org
Fri Mar 20 21:30:31 PDT 2009


Revision: 1041
          http://trac.macosforge.org/projects/ruby/changeset/1041
Author:   lsansonetti at apple.com
Date:     2009-03-20 21:30:31 -0700 (Fri, 20 Mar 2009)
Log Message:
-----------
let's raise SyntaxError exceptions when there is a parsing error instead of crashing

Modified Paths:
--------------
    MacRuby/branches/experimental/load.c
    MacRuby/branches/experimental/vm_eval.c

Modified: MacRuby/branches/experimental/load.c
===================================================================
--- MacRuby/branches/experimental/load.c	2009-03-21 04:16:12 UTC (rev 1040)
+++ MacRuby/branches/experimental/load.c	2009-03-21 04:30:31 UTC (rev 1041)
@@ -267,7 +267,9 @@
     // Load it.
     const char *fname_str = RSTRING_PTR(fname);
     NODE *node = (NODE *)rb_load_file(fname_str);
-    assert(node != NULL);
+    if (node == NULL) {
+	rb_raise(rb_eSyntaxError, "compile error");
+    }
     rb_vm_run_node(fname_str, node);
 }
 

Modified: MacRuby/branches/experimental/vm_eval.c
===================================================================
--- MacRuby/branches/experimental/vm_eval.c	2009-03-21 04:16:12 UTC (rev 1040)
+++ MacRuby/branches/experimental/vm_eval.c	2009-03-21 04:30:31 UTC (rev 1041)
@@ -314,7 +314,9 @@
 {
     // TODO honor scope
     NODE *node = rb_compile_string(file, src, line);
-    assert(node != NULL);
+    if (node == NULL) {
+	rb_raise(rb_eSyntaxError, "compile error");
+    }
     return rb_vm_run_node(file, node);
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090320/1d79fa74/attachment.html>


More information about the macruby-changes mailing list