Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

let's raise SyntaxError exceptions when there is a parsing error inst…

…ead of crashing

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/branches/experimental@1041 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
commit 22ef83cd322ad271306c34a56fdd1db7cafaf1ed 1 parent ac14de3
Laurent Sansonetti authored
Showing with 6 additions and 2 deletions.
  1. +3 −1 load.c
  2. +3 −1 vm_eval.c
View
4 load.c
@@ -267,7 +267,9 @@ rb_load(VALUE fname, int wrap)
// 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);
}
View
4 vm_eval.c
@@ -314,7 +314,9 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
{
// 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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.